Enum FindResult

Source
pub enum FindResult<'a, E, P: 'a> {
    Perfect(&'a P),
    Excluded(&'a P, Vec<E>),
    NotFound,
}
Expand description

The result of SubsetMap::find.

It can either be a perfect match on the subset or a match where some elements of the input set had to be excluded.

For FindResult::NotFound no tracking of excluded elements is done.

Variants§

§

Perfect(&'a P)

The input set exactly matched a combination of the original set and there was a payload.

§

Excluded(&'a P, Vec<E>)

There were some elements in the input set that had to be excluded to match a subset of the original set.

Still there was a payload at the given position.

The excluded elements are returned.

§

NotFound

There was no match at all or the payload for the matched subset was None

Implementations§

Source§

impl<'a, E, P> FindResult<'a, E, P>

Source

pub fn payload(&self) -> Option<&P>

Source

pub fn excluded_elements(&self) -> &[E]

Returns the excluded elements if there was a match at all.

If there was no match the returned slice is also empty.

Source

pub fn is_found_and_perfect(&self) -> bool

Returns true if there was a perfect match

Source

pub fn is_found_and_excluded(&self) -> bool

Returns true if there was a match but some elements had to be excluded

Source

pub fn is_not_found(&self) -> bool

Returns true if there was no match or if the payload for the matched subset was None

Source

pub fn is_found(&self) -> bool

Returns true if there was a match even though some elements had to be excluded and if there was a payload for the matched subset.

Trait Implementations§

Source§

impl<'a, E: Debug, P: Debug + 'a> Debug for FindResult<'a, E, P>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, E, P> Freeze for FindResult<'a, E, P>

§

impl<'a, E, P> RefUnwindSafe for FindResult<'a, E, P>

§

impl<'a, E, P> Send for FindResult<'a, E, P>
where P: Sync, E: Send,

§

impl<'a, E, P> Sync for FindResult<'a, E, P>
where P: Sync, E: Sync,

§

impl<'a, E, P> Unpin for FindResult<'a, E, P>
where E: Unpin,

§

impl<'a, E, P> UnwindSafe for FindResult<'a, E, P>

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.