Struct kernel::utilities::registers::ReadOnly

source ·
#[repr(transparent)]
pub struct ReadOnly<T, R = ()>{ value: T, associated_register: PhantomData<R>, }
Expand description

Read-only registers.

For accessing the register contents the Readable trait is implemented.

Fields§

§value: T§associated_register: PhantomData<R>

Trait Implementations§

source§

impl<T, R> Readable for ReadOnly<T, R>

§

type T = T

§

type R = R

source§

fn get(&self) -> T

Get the raw register value
source§

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

Read the value of the given field
source§

fn read_as_enum<E>(&self, field: Field<Self::T, Self::R>) -> Option<E>
where E: TryFromValue<Self::T, EnumType = E>,

Set the raw register value Read more
source§

fn extract(&self) -> LocalRegisterCopy<Self::T, Self::R>

Make a local copy of the register
source§

fn is_set(&self, field: Field<Self::T, Self::R>) -> bool

Check if one or more bits in a field are set
source§

fn any_matching_bits_set(&self, field: FieldValue<Self::T, Self::R>) -> bool

Check if any bits corresponding to the mask in the passed FieldValue are set. This function is identical to is_set() but operates on a FieldValue rather than a Field, allowing for checking if any bits are set across multiple, non-contiguous portions of a bitfield.
source§

fn matches_all(&self, field: FieldValue<Self::T, Self::R>) -> bool

Check if all specified parts of a field match
source§

fn matches_any(&self, fields: &[FieldValue<Self::T, Self::R>]) -> bool

Check if any of the passed parts of a field exactly match the contained value. This allows for matching on unset bits, or matching on specific values in multi-bit fields.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T, R> UnwindSafe for ReadOnly<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> Debuggable for T
where T: Readable,

source§

fn debug(&self) -> RegisterDebugValue<Self::T, Self::R>
where Self::R: RegisterDebugInfo<Self::T>,

Returns a RegisterDebugValue that implements core::fmt::Debug, the debug information is extracted from <Register>::DebugInfo.
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.