Skip to main content

DriverLabBuilder

Struct DriverLabBuilder 

Source
pub struct DriverLabBuilder { /* private fields */ }
Expand description

Builder for configuring and instantiating an EmbeddedLabServer inside an existing DFv2 driver.

Implementations§

Source§

impl DriverLabBuilder

Source

pub fn new(node_identity: impl Into<String>) -> Self

Creates a new builder for the given stable node/driver identity.

Source

pub fn from_context(context: &DriverContext) -> Self

Creates a new builder extracting the node identity from DriverContext.

Source

pub fn with_enabled(self, enabled: bool) -> Self

Explicitly enables or disables the embedded debug server (in release builds where enable_driver_lab = false, this defaults to false and omits outgoing service handlers).

Source

pub fn with_allow_mutating_sessions(self, allow: bool) -> Self

Sets whether mutating sessions are permitted on this embedded server.

Source

pub fn with_config(self, config: ProxyConfig) -> Self

Overrides the proxy configuration bounds (narrowing against baseline).

Source

pub fn with_quiesce_hook<F>(&mut self, hook: F) -> &mut Self
where F: Fn(bool) + Send + Sync + 'static,

Registers a synchronous quiesce callback (quiesce_hook(bool paused)) invoked with true when a mutating session acquires the mutation lease and false when the session closes or the driver stops (Spec Phase 2 Section 2.2).

Source

pub fn with_mmio( &mut self, name: impl Into<String>, vmo: &Vmo, offset: usize, size: usize, ) -> Result<ResourceId, Status>

Ergonomic helper to register a driver MMIO VMO by byte size.

Source

pub fn with_writable_registers( &mut self, id: ResourceId, offsets: Vec<u64>, ) -> &mut Self

Configures 32-bit writable register offsets on a registered MMIO resource.

Source

pub fn with_hard_denied_ranges( &mut self, id: ResourceId, ranges: Vec<(u64, u64)>, ) -> &mut Self

Configures hard-denied byte offset ranges (start, end) on a registered MMIO resource.

Source

pub fn with_interrupt(&mut self, name: impl Into<String>) -> ResourceId

Ergonomic alias for Self::add_interrupt.

Source

pub fn add_mmio_vmo( &mut self, name: impl Into<String>, vmo: &Vmo, offset: usize, logical_size: u64, ) -> Result<ResourceId, Status>

Shares an existing driver MMIO VMO with the embedded server using a default read/poll-permissive ceiling.

Duplicates vmo (zx::Rights::SAME_RIGHTS) and creates an independent local mapping in the driver host address space.

Source

pub fn add_mmio_vmo_with_ceiling( &mut self, name: impl Into<String>, vmo: &Vmo, offset: usize, logical_size: u64, ceiling: ResourceCeiling, ) -> Result<ResourceId, Status>

Shares an existing driver MMIO VMO with an explicit ResourceCeiling (such as hard_denied ranges for clear-on-read/FIFO registers and writable_registers for permitted mutations).

Source

pub fn add_mapped_mmio( &mut self, name: impl Into<String>, mmio: MappedMmio, logical_size: u64, ceiling: ResourceCeiling, ) -> ResourceId

Registers a pre-mapped MappedMmio region with an explicit ResourceCeiling.

Source

pub fn with_state_bank( &mut self, name: impl Into<String>, bank: StateBank, ) -> ResourceId

Registers an in-memory StateBank exposing software state slots, runtime knobs, read probes, and diagnostic triggers with a ResourceCeiling populated from bank.writable_offsets().

Source

pub fn add_state_bank( &mut self, name: impl Into<String>, bank: StateBank, ) -> ResourceId

Registers an in-memory StateBank using its configured writable offsets ceiling.

Source

pub fn add_state_bank_with_ceiling( &mut self, name: impl Into<String>, bank: StateBank, ceiling: ResourceCeiling, ) -> ResourceId

Registers an in-memory StateBank with an explicit ResourceCeiling.

Source

pub fn set_writable_registers( &mut self, resource_id: ResourceId, writable_registers: Vec<WritableRegister>, )

Configures the permitted 32-bit writable registers on an existing MMIO resource’s target ceiling.

Source

pub fn set_hard_denied_ranges( &mut self, resource_id: ResourceId, ranges: Vec<Range<u64>>, )

Configures the hard-denied byte offset ranges on an existing MMIO resource’s target ceiling.

Source

pub fn add_gpio( &mut self, name: impl Into<String>, proxy: GpioSynchronousProxy, ) -> ResourceId

Registers a GPIO protocol resource.

Source

pub fn add_i2c( &mut self, name: impl Into<String>, proxy: DeviceSynchronousProxy, ) -> ResourceId

Registers an I2C protocol resource.

Source

pub fn add_spi( &mut self, name: impl Into<String>, proxy: DeviceSynchronousProxy, ) -> ResourceId

Registers a SPI protocol resource.

Source

pub fn add_clock( &mut self, name: impl Into<String>, proxy: ClockSynchronousProxy, ) -> ResourceId

Registers a Clock protocol resource.

Source

pub fn add_reset( &mut self, name: impl Into<String>, proxy: ResetSynchronousProxy, ) -> ResourceId

Registers a Reset protocol resource.

Source

pub fn add_serial( &mut self, name: impl Into<String>, proxy: DeviceSynchronousProxy, ) -> ResourceId

Registers a Serial protocol resource.

Source

pub fn add_interrupt(&mut self, name: impl Into<String>) -> ResourceId

Registers an interrupt observation resource for event tapping.

Source

pub fn build(self) -> Result<EmbeddedLabServer, ProviderError>

Validates all registered resources and builds the EmbeddedLabServer.

Auto Trait Implementations§

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<F, N> FidlIntoNative<Box<N>> for F
where F: FidlIntoNative<N>,

§

fn fidl_into_native(self) -> Box<N>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
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.

§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Cast the given object into a dyn std::any::Any.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.