#[repr(transparent)]pub struct Flags<T>(pub T);Expand description
Flag set wrapping a primitive unsigned integer.
For named, fixed sets of flags use the bitflags crate. Flags<T> is
for ad hoc flag manipulation where bit positions are data.
use bitkit::Flags;
const READ: u32 = 1 << 0;
const WRITE: u32 = 1 << 1;
let mut f = Flags::<u32>::empty();
f.enable(READ | WRITE);
assert!(f.has(READ));
assert!(f.has_all(READ | WRITE));Tuple Fields§
§0: TImplementations§
Source§impl Flags<u8>
impl Flags<u8>
Source§impl Flags<u16>
impl Flags<u16>
Source§impl Flags<u32>
impl Flags<u32>
Source§impl Flags<u64>
impl Flags<u64>
Source§impl Flags<u128>
impl Flags<u128>
Trait Implementations§
impl<T: Copy> Copy for Flags<T>
impl<T: Eq> Eq for Flags<T>
impl<T> StructuralPartialEq for Flags<T>
Auto Trait Implementations§
impl<T> Freeze for Flags<T>where
T: Freeze,
impl<T> RefUnwindSafe for Flags<T>where
T: RefUnwindSafe,
impl<T> Send for Flags<T>where
T: Send,
impl<T> Sync for Flags<T>where
T: Sync,
impl<T> Unpin for Flags<T>where
T: Unpin,
impl<T> UnsafeUnpin for Flags<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Flags<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more