MockIO

Struct MockIO 

Source
pub struct MockIO<const N: usize>(/* private fields */);
Expand description

Mocked RegisterIO implementation.

Implemented as an array of N bytes, register writes and reads simply write to/from the internal array.

Implementations§

Source§

impl<const N: usize> MockIO<N>

Source

pub fn new_zeroed() -> Self

Construct a new zeroed instance of the mocked register memory.

Source

pub fn base_ptr(&self) -> *mut ()

Get the base register address of the instance (always 0).

Trait Implementations§

Source§

impl<const N: usize> RawRegisterIO for MockIO<N>

Source§

type Error = Infallible

The error type this register transport returns. For infallible transports (e.g., direct volatile pointer accesses), this should be core::convert::Infallible so that the Reg type can provide an infallible API in addition to the try_* API.
Source§

unsafe fn try_read<T: RegInt>(&self, ptr: *const T) -> Result<T, Self::Error>

Try to read a primitive integer from memory. Read more
Source§

unsafe fn try_write<T: RegInt>( &self, ptr: *mut T, value: T, ) -> Result<(), Self::Error>

Try to write primitive integer to memory Read more

Auto Trait Implementations§

§

impl<const N: usize> !Freeze for MockIO<N>

§

impl<const N: usize> !RefUnwindSafe for MockIO<N>

§

impl<const N: usize> Send for MockIO<N>

§

impl<const N: usize> !Sync for MockIO<N>

§

impl<const N: usize> Unpin for MockIO<N>

§

impl<const N: usize> UnwindSafe for MockIO<N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> RegisterIO for T
where T: RawRegisterIO,

Source§

type Error = <T as RawRegisterIO>::Error

Source§

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

Read a register value Read more
Source§

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

Write a register value Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.