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
sourceimpl<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
sourceimpl<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>>,
sourcefn bitand_assign(&mut self, rhs: B)
fn bitand_assign(&mut self, rhs: B)
Performs the &=
operation. Read more
sourceimpl<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>>,
sourcefn bitor_assign(&mut self, rhs: B)
fn bitor_assign(&mut self, rhs: B)
Performs the |=
operation. Read more
sourceimpl<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>>,
sourcefn bitxor_assign(&mut self, rhs: B)
fn bitxor_assign(&mut self, rhs: B)
Performs the ^=
operation. Read more
sourceimpl<Enum: PartialEq, Primitive: PartialEq> PartialEq<Flags<Enum, Primitive>> for Flags<Enum, Primitive>
impl<Enum: PartialEq, Primitive: PartialEq> PartialEq<Flags<Enum, Primitive>> for Flags<Enum, Primitive>
impl<Enum: Copy, Primitive: Copy> Copy for Flags<Enum, Primitive>
impl<Enum: Eq, Primitive: Eq> Eq for Flags<Enum, Primitive>
impl<Enum, Primitive> StructuralEq for Flags<Enum, Primitive>
impl<Enum, Primitive> StructuralPartialEq for Flags<Enum, Primitive>
Auto Trait Implementations
impl<Enum, Primitive> RefUnwindSafe for Flags<Enum, Primitive> where
Enum: RefUnwindSafe,
Primitive: RefUnwindSafe,
impl<Enum, Primitive> Send for Flags<Enum, Primitive> where
Enum: Send,
Primitive: Send,
impl<Enum, Primitive> Sync for Flags<Enum, Primitive> where
Enum: Sync,
Primitive: Sync,
impl<Enum, Primitive> Unpin for Flags<Enum, Primitive> where
Enum: Unpin,
Primitive: Unpin,
impl<Enum, Primitive> UnwindSafe for Flags<Enum, Primitive> where
Enum: UnwindSafe,
Primitive: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more