Skip to main content

scan_paths

Function scan_paths 

Source
pub fn scan_paths<'a>(
    paths: impl IntoIterator<Item = &'a Path>,
    options: &ScanOptions,
) -> Result<Output>
Expand description

Scan multiple native filesystem inputs in one in-process workflow run.

Absolute paths are supported as long as they can be resolved through a shared scan root by the internal pipeline.

use provenant::workflow::{scan_paths, ScanOptions};
use std::fs;
use tempfile::tempdir;

let root = tempdir()?;
let root = root.path();
let left = root.join("left");
let right = root.join("right");
fs::create_dir_all(&left)?;
fs::create_dir_all(&right)?;
fs::write(left.join("one.txt"), "left\n")?;
fs::write(right.join("two.txt"), "right\n")?;

let output = scan_paths([left.as_path(), right.as_path()], &ScanOptions::default())?;
let paths: Vec<_> = output.files.iter().map(|file| file.path.as_str()).collect();
assert!(paths.iter().any(|path| path.ends_with("one.txt")));
assert!(paths.iter().any(|path| path.ends_with("two.txt")));