pub trait Read<T: UIntLike> {
type Reg: RegisterLongName;
const REG_WIDTH: usize;
// Required methods
fn get(&self) -> T;
fn read(&self, field: Field<T, Self::Reg>) -> T;
fn read_as_enum<E: TryFromValue<T, EnumType = E>>(
&self,
field: Field<T, Self::Reg>,
) -> Option<E>;
fn extract(&self) -> LocalRegisterCopy<T, Self::Reg>;
fn is_set(&self, field: Field<T, Self::Reg>) -> bool;
fn any_matching_bits_set(&self, field: FieldValue<T, Self::Reg>) -> bool;
fn matches_all(&self, field: FieldValue<T, Self::Reg>) -> bool;
}
Expand description
Readable register
This interface is analogous to the methods supported on
tock_registers::registers::{ReadOnly, ReadWrite}
types
It is automatically implemented for all BaseReadableRegister
s
Required Associated Constants§
Required Associated Types§
type Reg: RegisterLongName
Required Methods§
Sourcefn read_as_enum<E: TryFromValue<T, EnumType = E>>(
&self,
field: Field<T, Self::Reg>,
) -> Option<E>
fn read_as_enum<E: TryFromValue<T, EnumType = E>>( &self, field: Field<T, Self::Reg>, ) -> Option<E>
Read value of the given field as an enum member
Sourcefn extract(&self) -> LocalRegisterCopy<T, Self::Reg>
fn extract(&self) -> LocalRegisterCopy<T, Self::Reg>
Make a local copy of the register
Sourcefn is_set(&self, field: Field<T, Self::Reg>) -> bool
fn is_set(&self, field: Field<T, Self::Reg>) -> bool
Check if one or more bits in a field are set
Sourcefn any_matching_bits_set(&self, field: FieldValue<T, Self::Reg>) -> bool
fn any_matching_bits_set(&self, field: FieldValue<T, Self::Reg>) -> bool
Check if any specified parts of a field match
Sourcefn matches_all(&self, field: FieldValue<T, Self::Reg>) -> bool
fn matches_all(&self, field: FieldValue<T, Self::Reg>) -> bool
Check if all specified parts of a field match
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.