INNER CODE UNIT · Rust
Entries
XayahSuSuSu/Android-DataBackup · source-next/native/src/main/jni/rustic/src/mapped_source.rs:27
type Entries = Box<dyn Iterator<Item = Entry> + Send>;
/// Applies source-specific mappings without copying content or changing where files are opened.
pub(crate) struct MappedSource {
roots: Vec<MappedRoot>,
}
impl MappedSource {
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| {