pub struct Scanner { /* private fields */ }Implementations§
Source§impl Scanner
impl Scanner
pub fn new(root: impl Into<PathBuf>) -> Self
pub fn options(self, options: ScanOptions) -> Self
Sourcepub fn runtime(self, runtime: ParallelRuntime) -> Self
pub fn runtime(self, runtime: ParallelRuntime) -> Self
Selects the executor used by parallel discovery.
Sourcepub fn scan(self) -> Result<ScanReport>
pub fn scan(self) -> Result<ScanReport>
Scans the configured repository root.
§Errors
Returns an error when the root cannot be canonicalized/read, or when a
local error occurs under ErrorPolicy::Abort.
Sourcepub fn scan_compact(self) -> Result<CompactScanReport>
pub fn scan_compact(self) -> Result<CompactScanReport>
Scans into a compact manifest that stores the canonical root once.
This is the preferred report for very large repositories when callers do not require an owned absolute path on every file record.
§Errors
Returns the same errors as Self::scan.
Sourcepub fn scan_incremental(self, previous: &ScanReport) -> Result<ScanReport>
pub fn scan_incremental(self, previous: &ScanReport) -> Result<ScanReport>
Scans while reusing strong hashes from an older persistent report when file identity, size and timestamps are unchanged.
§Errors
Returns the same errors as Self::scan. Reports from another root or
reports without file-version evidence are scanned without cache reuse.
Sourcepub fn scan_cached(self, cache: &ScanCache) -> Result<ScanReport>
pub fn scan_cached(self, cache: &ScanCache) -> Result<ScanReport>
Scans while reusing a compact, versioned local cache.
Incompatible versions and caches belonging to another canonical root are safely ignored.
§Errors
Returns the same errors as Self::scan.
Sourcepub fn scan_watch_plan(
self,
previous: &ScanReport,
plan: &WatchPlan,
) -> Result<ScanReport>
pub fn scan_watch_plan( self, previous: &ScanReport, plan: &WatchPlan, ) -> Result<ScanReport>
Applies a watcher plan without traversing unchanged directories.
Safe file-only plans re-match and inspect only changed paths, remove deleted paths, merge unchanged manifest evidence, and recompute the revision. Plans that can affect selection or directory structure fall back to a complete scan.
§Errors
Returns the same errors as Self::scan.
Source§impl Scanner
impl Scanner
Sourcepub fn visit_content<Factory, Visitor>(
self,
factory: Factory,
) -> Result<ContentVisitReport>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
pub fn visit_content<Factory, Visitor>(
self,
factory: Factory,
) -> Result<ContentVisitReport>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
Visits selected file bytes once with bounded parallelism.
Ignore rules, file limits, path safety, binary detection, content
hashing, and revision evidence use the same scanner configuration. A
worker-local visitor is created by factory; callback order is
intentionally concurrent. Every event carries a monotonic work
sequence plus its root and normalized relative path; use the paths for
deterministic cross-run ordering.
ContentVisitControl::SkipFile stops delivering chunks for the current
file. The scanner still finishes reading when hashing or binary
detection requires complete evidence. ContentVisitControl::Quit
cooperatively cancels every worker.
§Errors
Returns root, traversal, content I/O, or worker-submission failures according to the configured error policy.
§Panics
Propagates a panic from the factory or visitor after active workers observe cancellation.
Sourcepub fn visit_content_manifest<Factory, Visitor>(
self,
factory: Factory,
) -> Result<CompactScanReport>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
pub fn visit_content_manifest<Factory, Visitor>(
self,
factory: Factory,
) -> Result<CompactScanReport>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
Visits selected file bytes once and returns the exact compact manifest produced by those same verified reads.
This additive API lets parsers consume bytes and retain incremental scan
evidence without changing the long-standing ContentVisitReport
construction contract used by existing scanner consumers.
§Errors
Returns the same errors as Self::visit_content.
§Panics
Propagates callback panics like Self::visit_content.
Sourcepub fn visit_content_streaming<Factory, Visitor>(
self,
factory: Factory,
) -> Result<ContentVisitReport>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
pub fn visit_content_streaming<Factory, Visitor>(
self,
factory: Factory,
) -> Result<ContentVisitReport>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
Visits selected bytes without retaining a selected-file manifest or computing a revision.
Typed skip evidence is still retained when EvidenceMode::Complete is
configured. Use selected_files_only() as well for constant-memory
summary reporting.
§Errors
Returns the same errors as Self::visit_content.
§Panics
Propagates callback panics like Self::visit_content.
Sourcepub fn visit_changed_content<Factory, Visitor>(
self,
plan: &WatchPlan,
factory: Factory,
) -> Result<ChangedContentVisitOutcome>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
pub fn visit_changed_content<Factory, Visitor>(
self,
plan: &WatchPlan,
factory: Factory,
) -> Result<ChangedContentVisitOutcome>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
Visits only safe changed-file paths from a watcher plan.
No directory traversal occurs. Plans that can affect directory
structure or file-selection rules return
ChangedContentVisitOutcome::FullRescanRequired before invoking the
factory. Removed paths are returned separately.
§Errors
Returns root, matcher, content I/O, or worker-submission failures according to the configured error policy.
§Panics
Propagates a panic from the factory or visitor after active workers observe cancellation.
Sourcepub fn visit_changed_content_streaming<Factory, Visitor>(
self,
plan: &WatchPlan,
factory: Factory,
) -> Result<ChangedContentVisitOutcome>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
pub fn visit_changed_content_streaming<Factory, Visitor>(
self,
plan: &WatchPlan,
factory: Factory,
) -> Result<ChangedContentVisitOutcome>where
Factory: Fn(usize) -> Visitor + Send + Sync + 'static,
Visitor: for<'event> FnMut(ContentVisitEvent<'event>) -> ContentVisitControl + Send + 'static,
Visits only changed-file bytes without retaining their compact manifest or computing a subset revision.
§Errors
Returns the same errors as Self::visit_changed_content.
Source§impl Scanner
impl Scanner
Sourcepub fn scan_into<S>(self, sink: S) -> Result<ScanStreamReport>where
S: ScanSink,
pub fn scan_into<S>(self, sink: S) -> Result<ScanStreamReport>where
S: ScanSink,
Inspects and emits the deterministic manifest under synchronous backpressure without retaining selected file records.
The sink is invoked in normalized relative-path order. Returning
ScanSinkControl::Stop stops inspection and marks the stream summary
incomplete.
§Errors
Returns the same errors as Self::scan.