Enum LookupResult

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

The result of SubsetMap::lookup.

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

A value of None for the payload indicates that there was a match for a given subset but nevertheless there was no payload stored for that subset.

Variants§

§

Perfect(Option<&'a P>)

The input set exactly matched a combination of the original set.

§

Excluded(Option<&'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

The excluded elements are returned.

§

NoMatch

There was no match at all for the given subset

Implementations§

Source§

impl<'a, E, P> LookupResult<'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_perfect(&self) -> bool

Returns true if there was a perfect match

Source

pub fn is_excluded(&self) -> bool

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

Source

pub fn is_no_match(&self) -> bool

Returns true if there was no match at all

Source

pub fn is_match(&self) -> bool

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

Trait Implementations§

Source§

impl<'a, E: Debug, P: Debug + 'a> Debug for LookupResult<'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 LookupResult<'a, E, P>

§

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

§

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

§

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

§

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

§

impl<'a, E, P> UnwindSafe for LookupResult<'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.