Skip to main content

Register

Trait Register 

Source
pub trait Register: Sized {
    type Value: MmioOperand;

    const OFFSET: usize;

    // Required methods
    fn from_raw(value: Self::Value) -> Self;
    fn to_raw(&self) -> Self::Value;
}
Expand description

A trait for types representing a register at a fixed offset.

Types implementing this trait are typically wrappers around fundamental types (u8, u16, u32, u64) that provide bit-level access to fields within the register.

Required Associated Constants§

Source

const OFFSET: usize

The byte offset of this register within the MMIO region.

Required Associated Types§

Source

type Value: MmioOperand

The underlying integer type (e.g., u32) that holds the register bits.

Required Methods§

Source

fn from_raw(value: Self::Value) -> Self

Initializes the register type with a raw value, typically after reading from MMIO.

Source

fn to_raw(&self) -> Self::Value

Converts the register type back to its raw bits, typically before writing to MMIO.

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§