Trait Read

Source
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 BaseReadableRegisters

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn get(&self) -> T

Get the raw register value

Source

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

Read the value of the given field

Source

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

Source

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

Make a local copy of the register

Source

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

Check if one or more bits in a field are set

Source

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

Check if any specified parts of a field match

Source

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.

Implementors§

Source§

impl<R, T: UIntLike> Read<T> for R

Source§

const REG_WIDTH: usize = R::REG_WIDTH

Source§

type Reg = <R as BaseReadableRegister<T>>::Reg