Skip to main content

Offset

Struct Offset 

Source
pub struct Offset<H> { /* private fields */ }
Expand description

An MMIO handler that applies an offset to operations before dispatching the call to the next handler.

Use this combinator so that the inner handlers can operate in relative address spaces. For example, if a register bank is defined in an offset in conjunction with mmio::MmioSplit, it is desirable to reuse the same mmio::Register implementations in the fakes.

Implementations§

Source§

impl<H> Offset<H>

Source

pub fn new(inner: H, offset: usize) -> Self

Returns a new Offset that dispatches calls into inner after applying offset to VmoOpHelper in both loads and stores.

Trait Implementations§

Source§

impl<H: VmoMemoryHandler> GenericVmoMemoryHandler for Offset<H>

Source§

fn load<T: MmioOperand>(&self, op: VmoOpHelper<'_, T>) -> T

Handles an MMIO load operation for type T.
Source§

fn store<T: MmioOperand>(&self, op: VmoOpHelper<'_, T>, value: T)

Handles an MMIO store operation for type T.
Source§

impl<H: MaybeVmoMemoryHandler> MaybeVmoMemoryHandler for Offset<H>

Source§

fn get_handler( &self, range: Range<usize>, ) -> Option<&(impl VmoMemoryHandler + ?Sized)>

Returns a VmoMemoryHandler if range can be operated on by the implementer.

Auto Trait Implementations§

§

impl<H> Freeze for Offset<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for Offset<H>
where H: RefUnwindSafe,

§

impl<H> Send for Offset<H>
where H: Send,

§

impl<H> Sync for Offset<H>
where H: Sync,

§

impl<H> Unpin for Offset<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for Offset<H>
where H: UnsafeUnpin,

§

impl<H> UnwindSafe for Offset<H>
where H: UnwindSafe,

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<O> DispatchHandler for O
where O: VmoMemoryHandler + Send + Sync + 'static,

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<H> RegistryHandler for H
where H: VmoMemoryHandler + Send + Sync + 'static,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<O> VmoMemoryHandler for O

Source§

fn load8(&self, op: VmoOpHelper<'_, u8>) -> u8

Handles an 8-bit MMIO load operation.
Source§

fn load16(&self, op: VmoOpHelper<'_, u16>) -> u16

Handles a 16-bit MMIO load operation.
Source§

fn load32(&self, op: VmoOpHelper<'_, u32>) -> u32

Handles a 32-bit MMIO load operation.
Source§

fn load64(&self, op: VmoOpHelper<'_, u64>) -> u64

Handles a 64-bit MMIO load operation.
Source§

fn store8(&self, op: VmoOpHelper<'_, u8>, value: u8)

Handles an 8-bit MMIO store operation.
Source§

fn store16(&self, op: VmoOpHelper<'_, u16>, value: u16)

Handles a 16-bit MMIO store operation.
Source§

fn store32(&self, op: VmoOpHelper<'_, u32>, value: u32)

Handles a 32-bit MMIO store operation.
Source§

fn store64(&self, op: VmoOpHelper<'_, u64>, value: u64)

Handles a 64-bit MMIO store operation.