varflags

Struct Varflags

source
pub struct Varflags<E, B>(/* private fields */)
where
    E: Sized + Clone + TryFrom<Index<B>>,
    B: Bitset + Copy,
    B::Repr: From<E>;
Expand description

Struct representing set over variants of some enum E implemented using bitworks bitset B.

Implementations§

source§

impl<E, B> Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source

pub const NONE: Self = _

Empty set of variants.

source

pub const ALL: Self = _

Set of variants containing every variant of E.

source

pub const fn _from_inner(bitset: B) -> Self

Constructs Varflags from the inner Bitset.

source

pub fn contains(&self, variant: &E) -> bool

Returns true, if self contains a variant.

source

pub fn includes(&self, other: &Self) -> bool

Returns true, if self contains all variants of other.

source

pub fn intersects(&self, other: &Self) -> bool

Returns true, if both self and other share at least 1 variant.

source

pub fn variants<'a>(&'a self) -> impl Iterator<Item = E> + 'a

Returns iterator over variants contained in self.

Trait Implementations§

source§

impl<E, B> BitAnd<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: E) -> Self::Output

Performs the & operation. Read more
source§

impl<E, B> BitAnd for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl<E, B> BitAndAssign<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn bitand_assign(&mut self, rhs: E)

Performs the &= operation. Read more
source§

impl<E, B> BitAndAssign for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl<E, B> BitOr<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: E) -> Self::Output

Performs the | operation. Read more
source§

impl<E, B> BitOr for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl<E, B> BitOrAssign<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn bitor_assign(&mut self, rhs: E)

Performs the |= operation. Read more
source§

impl<E, B> BitOrAssign for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl<E, B> BitXor<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: E) -> Self::Output

Performs the ^ operation. Read more
source§

impl<E, B> BitXor for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl<E, B> BitXorAssign<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn bitxor_assign(&mut self, rhs: E)

Performs the ^= operation. Read more
source§

impl<E, B> BitXorAssign for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl<E, B> Clone for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + Clone, B: Bitset + Copy + Clone, B::Repr: From<E>,

source§

fn clone(&self) -> Varflags<E, B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<E, B> Debug for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + Display, B: Bitset + Copy, B::Repr: From<E>,

source§

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

Formats the value using the given formatter. Read more
source§

impl<E, B> Display for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + Display, B: Bitset + Copy, B::Repr: From<E>,

source§

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

Formats the value using the given formatter. Read more
source§

impl<E, B> FromIterator<E> for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

fn from_iter<T: IntoIterator<Item = E>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<E, B> Hash for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + Hash, B: Bitset + Copy + Hash, B::Repr: From<E>,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<E, B> Not for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

source§

type Output = Varflags<E, B>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<E, B> PartialEq for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + PartialEq, B: Bitset + Copy + PartialEq, B::Repr: From<E>,

source§

fn eq(&self, other: &Varflags<E, B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<E, B> Copy for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + Copy, B: Bitset + Copy + Copy, B::Repr: From<E>,

source§

impl<E, B> Eq for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>> + Eq, B: Bitset + Copy + Eq, B::Repr: From<E>,

source§

impl<E, B> StructuralPartialEq for Varflags<E, B>
where E: Sized + Clone + TryFrom<Index<B>>, B: Bitset + Copy, B::Repr: From<E>,

Auto Trait Implementations§

§

impl<E, B> Freeze for Varflags<E, B>
where <B as Bitset>::Repr: Sized, B: Freeze,

§

impl<E, B> RefUnwindSafe for Varflags<E, B>
where <B as Bitset>::Repr: Sized, B: RefUnwindSafe, E: RefUnwindSafe,

§

impl<E, B> Send for Varflags<E, B>
where <B as Bitset>::Repr: Sized, B: Send, E: Send,

§

impl<E, B> Sync for Varflags<E, B>
where <B as Bitset>::Repr: Sized, B: Sync, E: Sync,

§

impl<E, B> Unpin for Varflags<E, B>
where <B as Bitset>::Repr: Sized, B: Unpin, E: Unpin,

§

impl<E, B> UnwindSafe for Varflags<E, B>
where <B as Bitset>::Repr: Sized, B: UnwindSafe, E: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.