kernel::utilities::registers

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

Source§

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§

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.