tock_registers::fields

Struct FieldValue

Source
pub struct FieldValue<T: UIntLike, R: RegisterLongName> {
    pub value: T,
    /* private fields */
}
Expand description

Values for the specific register fields.

For the FieldValue, the masks and values are shifted into their actual location in the register.

Fields§

§value: T

Implementations§

Source§

impl<R: RegisterLongName> FieldValue<u8, R>

Source

pub const fn new(mask: u8, shift: usize, value: u8) -> Self

Source§

impl<R: RegisterLongName> FieldValue<u16, R>

Source

pub const fn new(mask: u16, shift: usize, value: u16) -> Self

Source§

impl<R: RegisterLongName> FieldValue<u32, R>

Source

pub const fn new(mask: u32, shift: usize, value: u32) -> Self

Source§

impl<R: RegisterLongName> FieldValue<u64, R>

Source

pub const fn new(mask: u64, shift: usize, value: u64) -> Self

Source§

impl<R: RegisterLongName> FieldValue<u128, R>

Source

pub const fn new(mask: u128, shift: usize, value: u128) -> Self

Source§

impl<R: RegisterLongName> FieldValue<usize, R>

Source

pub const fn new(mask: usize, shift: usize, value: usize) -> Self

Source§

impl<T: UIntLike, R: RegisterLongName> FieldValue<T, R>

Source

pub fn none() -> Self

Source

pub const fn mask(&self) -> T

Get the raw bitmask represented by this FieldValue.

Source

pub fn read(&self, field: Field<T, R>) -> T

Source

pub fn modify(self, val: T) -> T

Modify fields in a register value

Source

pub fn any_matching_bits_set(&self, val: T) -> bool

Check if any of the bits covered by the mask for this FieldValue and set in the FieldValue are also set in the passed value

Source

pub fn matches_all(&self, val: T) -> bool

Check if all specified parts of a field match

Trait Implementations§

Source§

impl<T: UIntLike, R: RegisterLongName> Add for FieldValue<T, R>

Source§

type Output = FieldValue<T, R>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<T: UIntLike, R: RegisterLongName> AddAssign for FieldValue<T, R>

Source§

fn add_assign(&mut self, rhs: FieldValue<T, R>)

Performs the += operation. Read more
Source§

impl<T: Clone + UIntLike, R: Clone + RegisterLongName> Clone for FieldValue<T, R>

Source§

fn clone(&self) -> FieldValue<T, R>

Returns a copy 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<R: RegisterLongName> From<FieldValue<u128, R>> for u128

Source§

fn from(val: FieldValue<u128, R>) -> u128

Converts to this type from the input type.
Source§

impl<R: RegisterLongName> From<FieldValue<u16, R>> for u16

Source§

fn from(val: FieldValue<u16, R>) -> u16

Converts to this type from the input type.
Source§

impl<R: RegisterLongName> From<FieldValue<u32, R>> for u32

Source§

fn from(val: FieldValue<u32, R>) -> u32

Converts to this type from the input type.
Source§

impl<R: RegisterLongName> From<FieldValue<u64, R>> for u64

Source§

fn from(val: FieldValue<u64, R>) -> u64

Converts to this type from the input type.
Source§

impl<R: RegisterLongName> From<FieldValue<u8, R>> for u8

Source§

fn from(val: FieldValue<u8, R>) -> u8

Converts to this type from the input type.
Source§

impl<R: RegisterLongName> From<FieldValue<usize, R>> for usize

Source§

fn from(val: FieldValue<usize, R>) -> usize

Converts to this type from the input type.
Source§

impl<T: Copy + UIntLike, R: Copy + RegisterLongName> Copy for FieldValue<T, R>

Auto Trait Implementations§

§

impl<T, R> Freeze for FieldValue<T, R>
where T: Freeze,

§

impl<T, R> RefUnwindSafe for FieldValue<T, R>

§

impl<T, R> Send for FieldValue<T, R>
where T: Send, R: Send,

§

impl<T, R> Sync for FieldValue<T, R>
where T: Sync, R: Sync,

§

impl<T, R> Unpin for FieldValue<T, R>
where T: Unpin, R: Unpin,

§

impl<T, R> UnwindSafe for FieldValue<T, R>
where T: UnwindSafe, R: UnwindSafe,

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<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.