Skip to main content

ScanQuery

Struct ScanQuery 

Source
pub struct ScanQuery<'a, K> { /* private fields */ }
Expand description

Borrowed query over findings produced by a batch scan.

Queries are lazy and allocation-free until sorting or collection is explicitly requested.

Implementations§

Source§

impl<'a, K> ScanQuery<'a, K>

Source

pub const fn severity(self, severity: Severity) -> Self

Restricts the query to findings with exactly severity.

This replaces any previously configured severity constraint.

Source

pub const fn minimum_severity(self, severity: Severity) -> Self

Restricts the query to findings whose severity is at least severity.

Severity follows its documented natural ordering: Info < Low < Medium < High < Critical.

This replaces any previously configured severity constraint.

Source

pub const fn confidence(self, confidence: Confidence) -> Self

Restricts the query to findings with exactly confidence.

This replaces any previously configured confidence constraint.

Source

pub const fn minimum_confidence(self, confidence: Confidence) -> Self

Restricts the query to findings whose confidence is at least confidence.

Confidence follows its documented natural ordering: Low < Medium < High.

This replaces any previously configured confidence constraint.

Source

pub const fn rule_id(self, rule_id: &'a str) -> Self

Restricts the query to findings produced by the exact rule identifier.

The identifier is borrowed by the query and is compared without allocation.

Source

pub const fn critical(self) -> Self

Restricts the query to critical findings.

Source

pub const fn high_priority(self) -> Self

Restricts the query to high- or critical-severity findings.

Source

pub const fn high_confidence(self) -> Self

Restricts the query to high-confidence findings.

Source

pub fn iter(&self) -> impl Iterator<Item = (&'a K, &'a Finding)> + '_

Iterates over every finding while retaining its source key.

The iterator is borrowed and allocation-free. Findings are yielded in source input order and in each report’s deterministic finding order.

Source

pub fn sort(&self, sort: ScanSort) -> SortedScanQuery<'a, K>
where K: Ord,

Materializes and sorts the findings selected by this query.

Filtering remains lazy until this method is called. Sorting allocates a vector containing borrowed (source, finding) pairs, but it never clones source keys or findings and never mutates the underlying ScanResults.

Source sorting requires K: Ord. The same bound is applied to the complete sorting API so one sort(ScanSort::...) method can cover every supported ordering consistently.

Source

pub fn count(&self) -> usize

Returns the number of findings selected by this query.

Source

pub fn first(&self) -> Option<(&'a K, &'a Finding)>

Returns the first finding selected by this query, if any.

Source

pub fn last(&self) -> Option<(&'a K, &'a Finding)>

Returns the last finding selected by this query, if any.

The query remains allocation-free. This walks the selected findings to completion because the underlying filtered iterator is not required to be double-ended.

Source

pub fn has_matches(&self) -> bool

Returns true when this query selects at least one finding.

Evaluation short-circuits at the first match.

Source

pub fn is_empty(&self) -> bool

Returns true when this query selects no findings.

Evaluation short-circuits at the first match.

Source

pub fn collect(&self) -> Vec<(&'a K, &'a Finding)>

Materializes the selected findings as borrowed (source, finding) pairs.

Neither source keys nor findings are cloned.

Trait Implementations§

Source§

impl<'a, K: Clone> Clone for ScanQuery<'a, K>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, K: Copy> Copy for ScanQuery<'a, K>

Source§

impl<'a, K: Debug> Debug for ScanQuery<'a, K>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, K> Freeze for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: Freeze,

§

impl<'a, K> RefUnwindSafe for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: RefUnwindSafe,

§

impl<'a, K> Send for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: Send,

§

impl<'a, K> Sync for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: Sync,

§

impl<'a, K> Unpin for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: Unpin,

§

impl<'a, K> UnsafeUnpin for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: UnsafeUnpin,

§

impl<'a, K> UnwindSafe for ScanQuery<'a, K>
where &'a [ScanEntry<K>]: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.