Skip to main content

Scanner

Struct Scanner 

Source
pub struct Scanner { /* private fields */ }

Implementations§

Source§

impl Scanner

Source

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.

Source

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.

Source

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.

Source

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

Source

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.

Source§

impl Scanner

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Source

pub fn options(self, options: ScanOptions) -> Self

Source

pub fn runtime(self, runtime: ParallelRuntime) -> Self

Selects the executor used by parallel discovery.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.