Trait MmioOperand

Source
pub trait MmioOperand:
    BitAnd<Output = Self>
    + BitOr<Output = Self>
    + Not<Output = Self>
    + MmioOperand
    + PartialEq
    + Copy
    + Debug
    + Display
    + Sized {
    // Required methods
    fn try_load<M: Mmio + ?Sized>(
        mmio: &M,
        offset: usize,
    ) -> Result<Self, MmioError>;
    fn try_store<M: Mmio + ?Sized>(
        mmio: &mut M,
        offset: usize,
        value: Self,
    ) -> Result<(), MmioError>;
}
Expand description

Implemented for the fundamental types supported by all Mmio implementations.

This is a sealed trait, implemented for the types: u8, u16, u32, u64.

Required Methods§

Source

fn try_load<M: Mmio + ?Sized>( mmio: &M, offset: usize, ) -> Result<Self, MmioError>

Loads a value of the this type from the MMIO region at the given offset.

§Errors
Source

fn try_store<M: Mmio + ?Sized>( mmio: &mut M, offset: usize, value: Self, ) -> Result<(), MmioError>

Stores a value of this type to the MMIO region at the given offset.

§Errors
  • MmioError::OutOfRange: if the store would exceed the bounds of this MMIO region.
  • [MmioError::Unaligned: if the offset is not suitably aligned.

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.

Implementations on Foreign Types§

Source§

impl MmioOperand for u8

Source§

fn try_load<M: Mmio + ?Sized>( mmio: &M, offset: usize, ) -> Result<Self, MmioError>

Source§

fn try_store<M: Mmio + ?Sized>( mmio: &mut M, offset: usize, value: Self, ) -> Result<(), MmioError>

Source§

impl MmioOperand for u16

Source§

fn try_load<M: Mmio + ?Sized>( mmio: &M, offset: usize, ) -> Result<Self, MmioError>

Source§

fn try_store<M: Mmio + ?Sized>( mmio: &mut M, offset: usize, value: Self, ) -> Result<(), MmioError>

Source§

impl MmioOperand for u32

Source§

fn try_load<M: Mmio + ?Sized>( mmio: &M, offset: usize, ) -> Result<Self, MmioError>

Source§

fn try_store<M: Mmio + ?Sized>( mmio: &mut M, offset: usize, value: Self, ) -> Result<(), MmioError>

Source§

impl MmioOperand for u64

Source§

fn try_load<M: Mmio + ?Sized>( mmio: &M, offset: usize, ) -> Result<Self, MmioError>

Source§

fn try_store<M: Mmio + ?Sized>( mmio: &mut M, offset: usize, value: Self, ) -> Result<(), MmioError>

Implementors§