Files
sized/crates/sized-core/examples/scan.rs
T
gamertan e0707447ad
Sized Linux checks / Linux AMD64 / Rust 1.88.0 (pull_request) Successful in 4m54s
Sized Linux checks / Linux AMD64 / Rust 1.88.0 (push) Successful in 4m57s
Adopt pinned public core snapshot and prepare Sized 2.0.0
2026-10-10 13:11:02 -04:00

26 lines
814 B
Rust

use sized::{scan_tree, ScanControl, ScanOptions};
use std::{error::Error, path::PathBuf};
fn main() -> Result<(), Box<dyn Error>> {
let Some(path) = std::env::args_os().nth(1).map(PathBuf::from) else {
eprintln!("Usage: scan PATH");
std::process::exit(2);
};
let report = scan_tree(&path, &ScanOptions::default(), &ScanControl::default())?;
println!(
"apparent={} allocated={} entries={} complete={} issues={}",
report.root.size_bytes,
report.root.blocks * 512,
report.entries_scanned,
report.root.complete,
report.issues.len()
);
if !report.root.complete {
for issue in report.issues {
eprintln!("{}: {}", issue.path.display(), issue.message);
}
std::process::exit(1);
}
Ok(())
}