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 EMPTY: LayerBitset
pub const EMPTY: LayerBitset
Empty bitset (no layers selected).
Sourcepub const ALL: LayerBitset
pub const ALL: LayerBitset
Bitset with every representable layer bit set.
Sourcepub const fn from_bits(bits: u32) -> LayerBitset
pub const fn from_bits(bits: u32) -> LayerBitset
Construct from raw bits (bit i = layer i).
Sourcepub const fn insert(self, index: usize) -> LayerBitset
pub const fn insert(self, index: usize) -> LayerBitset
Returns a copy with bit index set, if index is in range.
Sourcepub const fn is_superset_of(self, other: LayerBitset) -> bool
pub const fn is_superset_of(self, other: LayerBitset) -> 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§type Output = LayerBitset
type Output = LayerBitset
The resulting type after applying the
& operator.Source§fn bitand(self, rhs: LayerBitset) -> <LayerBitset as BitAnd>::Output
fn bitand(self, rhs: LayerBitset) -> <LayerBitset as BitAnd>::Output
Performs the
& operation. Read moreSource§impl BitOr for LayerBitset
impl BitOr for LayerBitset
Source§type Output = LayerBitset
type Output = LayerBitset
The resulting type after applying the
| operator.Source§fn bitor(self, rhs: LayerBitset) -> <LayerBitset as BitOr>::Output
fn bitor(self, rhs: LayerBitset) -> <LayerBitset as BitOr>::Output
Performs the
| operation. Read moreSource§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 moreSource§impl Debug for LayerBitset
impl Debug for LayerBitset
Source§impl Default for LayerBitset
impl Default for LayerBitset
Source§fn default() -> LayerBitset
fn default() -> LayerBitset
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LayerBitset
impl<'de> Deserialize<'de> for LayerBitset
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayerBitset, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayerBitset, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<u32> for LayerBitset
impl From<u32> for LayerBitset
Source§fn from(bits: u32) -> LayerBitset
fn from(bits: u32) -> LayerBitset
Converts to this type from the input type.
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 Copy for LayerBitset
impl Eq for LayerBitset
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