Skip to main content

BaseRegistry

Struct BaseRegistry 

Source
pub struct BaseRegistry<const STRICT: bool>(/* private fields */);
Expand description

A VMO handler registry that retrieves registered handlers by VMO KOID.

If STRICT is true, creating a handler for an unregistered VMO panics. Otherwise, it falls back to Passthrough.

Use BaseRegistry::register_handler or ScopedRegistry::register_handler to register RegistryHandler implementations that can be retrieved at-a-distance based on the VMO KOID.

Use this handler implementation in testing situations where the MMIO VMO might come over FIDL from an injected dependency. Register the VMO in a Registry before returning the VMO in an injected dependency fake.

Implementations§

Source§

impl<const STRICT: bool> BaseRegistry<STRICT>

Source

pub fn register_handler<H: RegistryHandler>(vmo: &Vmo, handler: H)

Registers handler for vmo.

The handler is installed in the global registry and never removed. See ScopedRegistry for alternatives.

Source

pub fn register_shared_handler(vmo: &Vmo, handler: Arc<dyn RegistryHandler>)

Registers a shared reference-counted handler for vmo.

The handler is installed in the global registry and never removed. See ScopedRegistry for alternatives.

Source

pub fn clear()

Clears all the registered VMOs.

Trait Implementations§

Source§

impl<const STRICT: bool> GenericVmoMemoryHandler for BaseRegistry<STRICT>

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<const STRICT: bool> VmoMemoryWrapper for BaseRegistry<STRICT>

Source§

fn new(vmo: &Vmo) -> Self

Creates a new handler instance for vmo.

Auto Trait Implementations§

§

impl<const STRICT: bool> !RefUnwindSafe for BaseRegistry<STRICT>

§

impl<const STRICT: bool> !UnwindSafe for BaseRegistry<STRICT>

§

impl<const STRICT: bool> Freeze for BaseRegistry<STRICT>

§

impl<const STRICT: bool> Send for BaseRegistry<STRICT>

§

impl<const STRICT: bool> Sync for BaseRegistry<STRICT>

§

impl<const STRICT: bool> Unpin for BaseRegistry<STRICT>

§

impl<const STRICT: bool> UnsafeUnpin for BaseRegistry<STRICT>

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.