Skip to main content

ScanDecision

Enum ScanDecision 

Source
pub enum ScanDecision<'s, T>
where T: Default,
{ Exclude(Option<Cow<'s, str>>), Include(T), }
Expand description

Enum representing the decision state for filters and detections.

Variants§

§

Exclude(Option<Cow<'s, str>>)

Exclude decision variant.

When a component is excluded, it may optionally include the name of the excluding rule.

§

Include(T)

Include decision variant.

When a component is included, this variant contains data containing inclusion information.

Implementations§

Source§

impl<'s, T> ScanDecision<'s, T>
where T: Default,

Source

pub fn take_include(self) -> Option<T>

Consumes the decision and returns the included data if this is an Include variant.

Returns None if this is an Exclude variant. This method consumes self, transferring ownership of the included data to the caller.

Source

pub fn get_include(&self) -> Option<&T>

Returns a reference to the included data if this is an Include variant.

Returns None if this is an Exclude variant. This is a non-consuming method that provides borrowed access to the included data.

Source

pub fn get_exclude(&self) -> Option<&Option<Cow<'_, str>>>

Returns a reference to the exclude reason if this is an Exclude variant.

Returns None if this is an Include variant. The returned value is an Option<&Option<Cow<'_, str>>> representing the optional exclusion rule.

Source

pub fn is_include(&self) -> bool

Returns true if this is an Include variant.

Source

pub fn is_exclude(&self) -> bool

Returns true if this is an Exclude variant.

Source

pub fn is_default_exclude(&self) -> bool

Returns true if this is an Exclude variant with no specific rule.

This indicates a default exclusion where Exclude(None) was used, distinguishing it from exclusions from a specific exclusion rule.

Trait Implementations§

Source§

impl<'s, T> Debug for ScanDecision<'s, T>
where T: Default + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s, T> Freeze for ScanDecision<'s, T>
where T: Freeze,

§

impl<'s, T> RefUnwindSafe for ScanDecision<'s, T>
where T: RefUnwindSafe,

§

impl<'s, T> Send for ScanDecision<'s, T>
where T: Send,

§

impl<'s, T> Sync for ScanDecision<'s, T>
where T: Sync,

§

impl<'s, T> Unpin for ScanDecision<'s, T>
where T: Unpin,

§

impl<'s, T> UnsafeUnpin for ScanDecision<'s, T>
where T: UnsafeUnpin,

§

impl<'s, T> UnwindSafe for ScanDecision<'s, T>
where T: 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> 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.