pub struct SB21(/* private fields */);Expand description
a type used to represent a field with a specific amount of bits.
Implementations§
Source§impl SB21
impl SB21
Sourcepub const BIT_LENGTH: usize = 21usize
pub const BIT_LENGTH: usize = 21usize
the bit length of this type.
Sourcepub fn new(
value: <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed,
) -> Self
pub fn new( value: <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed, ) -> Self
creates a new instance of this bitfield type with the given value.
this function panics if the value does not fit within the bit length of this type.
Sourcepub fn try_new(
value: <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed,
) -> Option<Self>
pub fn try_new( value: <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed, ) -> Option<Self>
creates a new instance of this bitfield type with the given value.
if the value does not fit within the bit length of this type, returns None.
Sourcepub unsafe fn new_unchecked(
value: <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed,
) -> Self
pub unsafe fn new_unchecked( value: <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed, ) -> Self
creates a new instance of this bitfield type with the given value, without checking that the value fits within the bit length of this type.
§safety
the provided value must fit within the bit length of this type.
Sourcepub fn get(
&self,
) -> <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed
pub fn get( &self, ) -> <<BitLength<21> as AssociatedStorage>::Storage as BitStorage>::Signed
returns the inner value.
Trait Implementations§
Source§impl BitPiece for SB21
impl BitPiece for SB21
Source§type Bits = <BitLength<21> as AssociatedStorage>::Storage
type Bits = <BitLength<21> as AssociatedStorage>::Storage
the storage type used internally to store the bits of this bitpiece.
Source§type Mut<'s, S: BitStorage + 's> = GenericBitPieceMut<'s, S, SB21>
type Mut<'s, S: BitStorage + 's> = GenericBitPieceMut<'s, S, SB21>
the type used to represent a mutable reference to this type inside another bitpiece.
Source§fn from_fields(fields: Self::Fields) -> Self
fn from_fields(fields: Self::Fields) -> Self
constructs this type from the given fields.
Source§fn try_from_bits(bits: Self::Bits) -> Option<Self>
fn try_from_bits(bits: Self::Bits) -> Option<Self>
tries to construct this type from the given bits, if the given bits represent a valid value of this type.
Source§impl Ord for SB21
impl Ord for SB21
Source§impl PartialOrd for SB21
impl PartialOrd for SB21
impl Copy for SB21
impl Eq for SB21
impl StructuralPartialEq for SB21
Auto Trait Implementations§
impl Freeze for SB21
impl RefUnwindSafe for SB21
impl Send for SB21
impl Sync for SB21
impl Unpin for SB21
impl UnwindSafe for SB21
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