Struct kernel::utilities::registers::FieldValue

source ·
pub struct FieldValue<T, R>{
    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> FieldValue<u8, R>

source

pub const fn new(mask: u8, shift: usize, value: u8) -> FieldValue<u8, R>

source§

impl<R> FieldValue<u16, R>

source

pub const fn new(mask: u16, shift: usize, value: u16) -> FieldValue<u16, R>

source§

impl<R> FieldValue<u32, R>

source

pub const fn new(mask: u32, shift: usize, value: u32) -> FieldValue<u32, R>

source§

impl<R> FieldValue<u64, R>

source

pub const fn new(mask: u64, shift: usize, value: u64) -> FieldValue<u64, R>

source§

impl<R> FieldValue<u128, R>

source

pub const fn new(mask: u128, shift: usize, value: u128) -> FieldValue<u128, R>

source§

impl<R> FieldValue<usize, R>

source

pub const fn new( mask: usize, shift: usize, value: usize, ) -> FieldValue<usize, R>

source§

impl<T, R> FieldValue<T, R>

source

pub fn none() -> FieldValue<T, R>

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, R> Add for FieldValue<T, R>

§

type Output = FieldValue<T, R>

The resulting type after applying the + operator.
source§

fn add(self, rhs: FieldValue<T, R>) -> FieldValue<T, R>

Performs the + operation. Read more
source§

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

source§

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

Performs the += operation. Read more
source§

impl<T, R> 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 From<Value> for FieldValue<u16, Register>

source§

fn from(v: Value) -> Self

Converts to this type from the input type.
source§

impl<T, R> 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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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

§

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.