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>
impl<'a, E, P> LookupResult<'a, E, P>
pub fn payload(&self) -> Option<&P>
Sourcepub fn excluded_elements(&self) -> &[E]
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.
Sourcepub fn is_perfect(&self) -> bool
pub fn is_perfect(&self) -> bool
Returns true
if there was a perfect match
Sourcepub fn is_excluded(&self) -> bool
pub fn is_excluded(&self) -> bool
Returns true
if there was a match
but some elements had to be excluded
Sourcepub fn is_no_match(&self) -> bool
pub fn is_no_match(&self) -> bool
Returns true
if there was no match at all