Struct sawp_flags::Flags
source · #[repr(transparent)]pub struct Flags<Enum, Primitive = <Enum as Flag>::Primitive> { /* private fields */ }
Expand description
Storage type for handling flags
Implementations§
source§impl<Enum> Flags<Enum>where
Enum: Flag,
impl<Enum> Flags<Enum>where Enum: Flag,
sourcepub fn from_bits(bits: <Enum as Flag>::Primitive) -> Self
pub fn from_bits(bits: <Enum as Flag>::Primitive) -> Self
Get a flag from a numeric value
Note: the value is unchecked so any bit may be set. Be
careful because PartialEq
is a direct comparison of
underlying bits.
sourcepub fn bits_ref(&self) -> &<Enum as Flag>::Primitive
pub fn bits_ref(&self) -> &<Enum as Flag>::Primitive
Reference to numeric representation of the variant
sourcepub fn intersects<B: Into<Flags<Enum>>>(self, rhs: B) -> bool
pub fn intersects<B: Into<Flags<Enum>>>(self, rhs: B) -> bool
Check if at least one flag in common is set
sourcepub fn contains<B: Into<Flags<Enum>>>(self, rhs: B) -> bool
pub fn contains<B: Into<Flags<Enum>>>(self, rhs: B) -> bool
Check if all flags provided in rhs
are set
pub fn is_empty(&self) -> bool
pub fn is_all(&self) -> bool
Trait Implementations§
source§impl<T, B> BitAndAssign<B> for Flags<T>where
T: Flag,
B: Into<Flags<T>>,
impl<T, B> BitAndAssign<B> for Flags<T>where T: Flag, B: Into<Flags<T>>,
source§fn bitand_assign(&mut self, rhs: B)
fn bitand_assign(&mut self, rhs: B)
Performs the
&=
operation. Read moresource§impl<T, B> BitOrAssign<B> for Flags<T>where
T: Flag,
B: Into<Flags<T>>,
impl<T, B> BitOrAssign<B> for Flags<T>where T: Flag, B: Into<Flags<T>>,
source§fn bitor_assign(&mut self, rhs: B)
fn bitor_assign(&mut self, rhs: B)
Performs the
|=
operation. Read moresource§impl<T, B> BitXorAssign<B> for Flags<T>where
T: Flag,
B: Into<Flags<T>>,
impl<T, B> BitXorAssign<B> for Flags<T>where T: Flag, B: Into<Flags<T>>,
source§fn bitxor_assign(&mut self, rhs: B)
fn bitxor_assign(&mut self, rhs: B)
Performs the
^=
operation. Read more