INNER CODE UNIT · Rust

new

XayahSuSuSu/Android-DataBackup · source-next/native/src/main/jni/rustic/src/mapped_source.rs:35

    pub fn new(mappings: &[SourceMapping]) -> Result<Self> {
        if mappings.is_empty() {
            return Err("At least one source mapping is required".into());
        }
        let mut paths: Vec<(PathBuf, PathBuf)> = Vec::new();
        for mapping in mappings {
            let source = Path::new(&mapping.source_path).canonicalize()?;
            let path = Path::new(&mapping.snapshot_path);
            if mapping.snapshot_path.is_empty()
                || path.components().any(|part| {
                    matches!(
                        part,
                        Component::ParentDir | Component::CurDir | Component::Prefix(_)
                    )
                })
            {
                return Err(
                    "Snapshot paths must not be empty or contain traversal components".into(),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…