Skip to main content

FilterableEnum

Trait FilterableEnum 

Source
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§

Source

fn filterable_id(&self) -> Self::Id

Reads the bitflag identifying the current variant.

Provided Methods§

Source

fn filter_ref(&self, filter: impl Into<Self::Filter>) -> Option<&Self>

Borrows this enum if its variant is included in filter.

Source

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".

Implementors§