Struct tock_registers::fields::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>

§

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> 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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

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

§

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>,

§

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.