pub struct LayerBitset(/* private fields */);Expand description
Fixed-capacity bitset of layers for modifier / conditional-layer state.
Bit i corresponds to layer index i.
Capacity is Self::BITS layers (indices 0..=[MAX_BITSET_LAYER]).
This is a thin no_std newtype over u32
so keymap const data can build bitsets
without a heap or an external bitset crate.
Widening capacity later is a storage-type change (u64, u128, or multi-limb)
behind the same API.
Implementations§
Source§impl LayerBitset
impl LayerBitset
Sourcepub const fn insert(self, index: usize) -> Self
pub const fn insert(self, index: usize) -> Self
Returns a copy with bit index set, if index is in range.
Sourcepub const fn remove(self, index: usize) -> Self
pub const fn remove(self, index: usize) -> Self
Returns a copy with bit index cleared, if index is in range.
Sourcepub const fn is_superset_of(self, other: Self) -> bool
pub const fn is_superset_of(self, other: Self) -> bool
Returns true if every bit set in other is also set in self.
Trait Implementations§
Source§impl BitAnd for LayerBitset
impl BitAnd for LayerBitset
Source§impl BitOr for LayerBitset
impl BitOr for LayerBitset
Source§impl Clone for LayerBitset
impl Clone for LayerBitset
Source§fn clone(&self) -> LayerBitset
fn clone(&self) -> LayerBitset
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LayerBitset
Source§impl Debug for LayerBitset
impl Debug for LayerBitset
Source§impl Default for LayerBitset
impl Default for LayerBitset
Source§impl<'de> Deserialize<'de> for LayerBitset
impl<'de> Deserialize<'de> for LayerBitset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for LayerBitset
Source§impl From<LayerBitset> for u32
impl From<LayerBitset> for u32
Source§fn from(bitset: LayerBitset) -> Self
fn from(bitset: LayerBitset) -> Self
Converts to this type from the input type.
Source§impl From<u32> for LayerBitset
impl From<u32> for LayerBitset
Source§impl Not for LayerBitset
impl Not for LayerBitset
Source§impl PartialEq for LayerBitset
impl PartialEq for LayerBitset
Source§fn eq(&self, other: &LayerBitset) -> bool
fn eq(&self, other: &LayerBitset) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LayerBitset
Auto Trait Implementations§
impl Freeze for LayerBitset
impl RefUnwindSafe for LayerBitset
impl Send for LayerBitset
impl Sync for LayerBitset
impl Unpin for LayerBitset
impl UnsafeUnpin for LayerBitset
impl UnwindSafe for LayerBitset
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