pub trait FilterableEnum: Sized {
type Id;
type Filter: EnumFilter<Self::Id>;
// Required method
fn filterable_id(&self) -> Self::Id;
// Provided methods
fn filter_ref(&self, filter: impl Into<Self::Filter>) -> Option<&Self> { ... }
fn filter_and_take(self, filter: impl Into<Self::Filter>) -> Option<Self> { ... }
}Expand description
An enum that can be filtered by its variant’s bitflag.
Implemented by filterable_enum directly on the annotated enum.
Required Associated Types§
Required Methods§
Sourcefn filterable_id(&self) -> Self::Id
fn filterable_id(&self) -> Self::Id
Reads the bitflag identifying the current variant.
Provided Methods§
Sourcefn filter_ref(&self, filter: impl Into<Self::Filter>) -> Option<&Self>
fn filter_ref(&self, filter: impl Into<Self::Filter>) -> Option<&Self>
Borrows this enum if its variant is included in filter.
Sourcefn filter_and_take(self, filter: impl Into<Self::Filter>) -> Option<Self>
fn filter_and_take(self, filter: impl Into<Self::Filter>) -> Option<Self>
Takes this enum if its variant is included in filter.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".