pub struct ScanResult {
pub matches: Vec<Match>,
pub truncated: bool,
pub elapsed: Duration,
pub cache_hit: bool,
}Expand description
Diagnostic-bearing wrapper around a scan result.
Every consumer pipeline ends up reconstructing these flags ad-hoc (was the scan truncated? how long did it take? did we hit the disk cache?). Centralising them gives downstream tooling (telemetry pipelines, watch-mode dashboards, perf benches) a single struct to read instead of parsing engine-specific output.
ScanResult::matches is the primary payload - consumers that
don’t care about diagnostics can result.matches and ignore the
rest. The struct is Clone so it can be passed across thread
boundaries and Default so tests can fabricate empties.
Fields§
§matches: Vec<Match>Sorted matches produced by the engine.
truncated: boolTrue when the engine hit the per-dispatch max_matches cap
AND the underlying scan reported overflow. Consumers should
treat truncated results as incomplete and re-scan with a
larger cap if every match matters (security audits).
elapsed: DurationTotal wall-clock time the scan call spent, including dispatch
- readback.
Duration::ZEROwhen the engine doesn’t measure.
cache_hit: boolTrue when the engine was loaded from disk cache instead of being recompiled. Used by perf tooling to attribute cold- start cost.
Implementations§
Source§impl ScanResult
impl ScanResult
Sourcepub fn from_matches(matches: Vec<Match>) -> Self
pub fn from_matches(matches: Vec<Match>) -> Self
Build a result from a bare match vector. Diagnostic flags default to safe values (not truncated, zero elapsed, no cache hit). For engines that produce richer diagnostics, construct the struct directly.
Trait Implementations§
Source§impl Clone for ScanResult
impl Clone for ScanResult
Source§fn clone(&self) -> ScanResult
fn clone(&self) -> ScanResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScanResult
impl Debug for ScanResult
Source§impl Default for ScanResult
impl Default for ScanResult
Source§fn default() -> ScanResult
fn default() -> ScanResult
Auto Trait Implementations§
impl Freeze for ScanResult
impl RefUnwindSafe for ScanResult
impl Send for ScanResult
impl Sync for ScanResult
impl Unpin for ScanResult
impl UnsafeUnpin for ScanResult
impl UnwindSafe for ScanResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more