RegisterIO

Trait RegisterIO 

Source
pub trait RegisterIO {
    type Error;

    // Required methods
    unsafe fn try_read_register<R: Register>(
        &self,
        ptr: *const R::Regwidth,
    ) -> Result<R, Self::Error>
       where R::Access: Read;
    unsafe fn try_write_register<R: Register>(
        &self,
        ptr: *mut R::Regwidth,
        value: R,
    ) -> Result<(), Self::Error>
       where R::Access: Write;
}
Expand description

Register I/O

Register accesses are performed through implementers of this trait. This trait’s methods handle details like endianness, multi-word writes, etc.

Most user I/O interfaces should simply implement the RawRegisterIO trait, since a blanket implementation exists for all implementers of RawRegisterIO.

Required Associated Types§

Required Methods§

Source

unsafe fn try_read_register<R: Register>( &self, ptr: *const R::Regwidth, ) -> Result<R, Self::Error>
where R::Access: Read,

Read a register value

This method must respect the register’s endianness and accesswidth, as encoded in the generic Register’s associated types.

§Safety

This method may dereference a raw pointer. The caller must ensure the pointer is valid and points to a valid memory location.

Source

unsafe fn try_write_register<R: Register>( &self, ptr: *mut R::Regwidth, value: R, ) -> Result<(), Self::Error>
where R::Access: Write,

Write a register value

This method must respect the register’s endianness and accesswidth, as encoded in the generic Register’s associated types.

§Safety

This method may dereference a raw pointer. The caller must ensure the pointer is valid and points to a valid writeable memory location.

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§