Skip to main content

TestBitfield

Struct TestBitfield 

Source
pub struct TestBitfield(/* private fields */);
Expand description

Struct with the actual data.

Trait Implementations§

Source§

impl Bitfield for TestBitfield

Source§

type BaseType = u32

The bitfield’s underlying type.
Source§

const MAX_BITS: u8 = _

The maximum number of bits that the bitfield can hold. Used for compile-time checking that no newly added field requires a Self::BaseType wider than this.
Source§

impl Clone for TestBitfield

Source§

fn clone(&self) -> TestBitfield

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TestBitfield

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deref for TestBitfield

Implement this so that accesses to fields of $bitfield_name actually access the zero-sized struct Fields

Source§

type Target = Fields

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for TestBitfield

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Display for TestBitfield

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Field<TestBitfield> for field_1

Source§

const SIZE: u8 = 2

The field’s size in bits. Specified by the user.
Source§

const OFFSET: u8 = 0

The field’s offset from the underlying value’s least significant bit, in bits. Read more
Source§

const MASK: <TestBitfield as Bitfield>::BaseType

The field’s mask that can be used to extract the last Self::SIZE bits from any B::BaseType. Computed automatically. Read more
Source§

fn is_set(&self) -> bool

Returns true if the field is not equal to zero.
Source§

const VALID: bool = _

true if the field is within the bitfield’s bounds. Used for compile-time checking.
Source§

fn size(&self) -> u8

Returns the size of a field at runtime, while Self::SIZE is used on the type of the field at compile-time.
Source§

fn offset(&self) -> u8

Returns the offset of a field at runtime, while Self::OFFSET is used on the type of the field at compile-time.
Source§

fn mask(&self) -> B::BaseType

Returns the mask of a field at runtime, while Self::MASK is used on the type of the field at compile-time.
Source§

fn get(&self) -> B::BaseType

Returns the current value of the field. Read more
Source§

fn set(&mut self, new_value: B::BaseType)

Sets the value of a field. If the value is wider than the field, the value’s lowest Self::SIZE bits will be used. Read more
Source§

fn set_checked(&mut self, new_value: B::BaseType) -> Result<(), B::BaseType>

Sets the value of a field. If the value is wider than the field, returns an Err result containing the value’s lowest Self::SIZE bits and doesn’t modify the field. Read more
Source§

impl Field<TestBitfield> for field_2

Source§

const SIZE: u8 = 5

The field’s size in bits. Specified by the user.
Source§

const OFFSET: u8

The field’s offset from the underlying value’s least significant bit, in bits. Read more
Source§

const MASK: <TestBitfield as Bitfield>::BaseType

The field’s mask that can be used to extract the last Self::SIZE bits from any B::BaseType. Computed automatically. Read more
Source§

fn is_set(&self) -> bool

Returns true if the field is not equal to zero.
Source§

const VALID: bool = _

true if the field is within the bitfield’s bounds. Used for compile-time checking.
Source§

fn size(&self) -> u8

Returns the size of a field at runtime, while Self::SIZE is used on the type of the field at compile-time.
Source§

fn offset(&self) -> u8

Returns the offset of a field at runtime, while Self::OFFSET is used on the type of the field at compile-time.
Source§

fn mask(&self) -> B::BaseType

Returns the mask of a field at runtime, while Self::MASK is used on the type of the field at compile-time.
Source§

fn get(&self) -> B::BaseType

Returns the current value of the field. Read more
Source§

fn set(&mut self, new_value: B::BaseType)

Sets the value of a field. If the value is wider than the field, the value’s lowest Self::SIZE bits will be used. Read more
Source§

fn set_checked(&mut self, new_value: B::BaseType) -> Result<(), B::BaseType>

Sets the value of a field. If the value is wider than the field, returns an Err result containing the value’s lowest Self::SIZE bits and doesn’t modify the field. Read more
Source§

impl From<TestBitfield> for u32

Source§

fn from(val: TestBitfield) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for TestBitfield

Source§

fn from(val: u32) -> Self

Converts to this type from the input type.
Source§

impl Copy for TestBitfield

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.