pub struct DriverLabBuilder { /* private fields */ }Expand description
Builder for configuring and instantiating an EmbeddedLabServer inside
an existing DFv2 driver.
Implementations§
Source§impl DriverLabBuilder
impl DriverLabBuilder
Sourcepub fn new(node_identity: impl Into<String>) -> Self
pub fn new(node_identity: impl Into<String>) -> Self
Creates a new builder for the given stable node/driver identity.
Sourcepub fn from_context(context: &DriverContext) -> Self
pub fn from_context(context: &DriverContext) -> Self
Creates a new builder extracting the node identity from DriverContext.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
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).
Sourcepub fn with_allow_mutating_sessions(self, allow: bool) -> Self
pub fn with_allow_mutating_sessions(self, allow: bool) -> Self
Sets whether mutating sessions are permitted on this embedded server.
Sourcepub fn with_config(self, config: ProxyConfig) -> Self
pub fn with_config(self, config: ProxyConfig) -> Self
Overrides the proxy configuration bounds (narrowing against baseline).
Sourcepub fn with_quiesce_hook<F>(&mut self, hook: F) -> &mut Self
pub fn with_quiesce_hook<F>(&mut self, hook: F) -> &mut Self
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).
Sourcepub fn with_mmio(
&mut self,
name: impl Into<String>,
vmo: &Vmo,
offset: usize,
size: usize,
) -> Result<ResourceId, Status>
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.
Sourcepub fn with_writable_registers(
&mut self,
id: ResourceId,
offsets: Vec<u64>,
) -> &mut Self
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.
Sourcepub fn with_hard_denied_ranges(
&mut self,
id: ResourceId,
ranges: Vec<(u64, u64)>,
) -> &mut Self
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.
Sourcepub fn with_interrupt(&mut self, name: impl Into<String>) -> ResourceId
pub fn with_interrupt(&mut self, name: impl Into<String>) -> ResourceId
Ergonomic alias for Self::add_interrupt.
Sourcepub fn add_mmio_vmo(
&mut self,
name: impl Into<String>,
vmo: &Vmo,
offset: usize,
logical_size: u64,
) -> Result<ResourceId, Status>
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.
Sourcepub fn add_mmio_vmo_with_ceiling(
&mut self,
name: impl Into<String>,
vmo: &Vmo,
offset: usize,
logical_size: u64,
ceiling: ResourceCeiling,
) -> Result<ResourceId, Status>
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).
Sourcepub fn add_mapped_mmio(
&mut self,
name: impl Into<String>,
mmio: MappedMmio,
logical_size: u64,
ceiling: ResourceCeiling,
) -> ResourceId
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.
Sourcepub fn with_state_bank(
&mut self,
name: impl Into<String>,
bank: StateBank,
) -> ResourceId
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().
Sourcepub fn add_state_bank(
&mut self,
name: impl Into<String>,
bank: StateBank,
) -> ResourceId
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.
Sourcepub fn add_state_bank_with_ceiling(
&mut self,
name: impl Into<String>,
bank: StateBank,
ceiling: ResourceCeiling,
) -> ResourceId
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.
Sourcepub fn set_writable_registers(
&mut self,
resource_id: ResourceId,
writable_registers: Vec<WritableRegister>,
)
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.
Sourcepub fn set_hard_denied_ranges(
&mut self,
resource_id: ResourceId,
ranges: Vec<Range<u64>>,
)
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.
Sourcepub fn add_gpio(
&mut self,
name: impl Into<String>,
proxy: GpioSynchronousProxy,
) -> ResourceId
pub fn add_gpio( &mut self, name: impl Into<String>, proxy: GpioSynchronousProxy, ) -> ResourceId
Registers a GPIO protocol resource.
Sourcepub fn add_i2c(
&mut self,
name: impl Into<String>,
proxy: DeviceSynchronousProxy,
) -> ResourceId
pub fn add_i2c( &mut self, name: impl Into<String>, proxy: DeviceSynchronousProxy, ) -> ResourceId
Registers an I2C protocol resource.
Sourcepub fn add_spi(
&mut self,
name: impl Into<String>,
proxy: DeviceSynchronousProxy,
) -> ResourceId
pub fn add_spi( &mut self, name: impl Into<String>, proxy: DeviceSynchronousProxy, ) -> ResourceId
Registers a SPI protocol resource.
Sourcepub fn add_clock(
&mut self,
name: impl Into<String>,
proxy: ClockSynchronousProxy,
) -> ResourceId
pub fn add_clock( &mut self, name: impl Into<String>, proxy: ClockSynchronousProxy, ) -> ResourceId
Registers a Clock protocol resource.
Sourcepub fn add_reset(
&mut self,
name: impl Into<String>,
proxy: ResetSynchronousProxy,
) -> ResourceId
pub fn add_reset( &mut self, name: impl Into<String>, proxy: ResetSynchronousProxy, ) -> ResourceId
Registers a Reset protocol resource.
Sourcepub fn add_serial(
&mut self,
name: impl Into<String>,
proxy: DeviceSynchronousProxy,
) -> ResourceId
pub fn add_serial( &mut self, name: impl Into<String>, proxy: DeviceSynchronousProxy, ) -> ResourceId
Registers a Serial protocol resource.
Sourcepub fn add_interrupt(&mut self, name: impl Into<String>) -> ResourceId
pub fn add_interrupt(&mut self, name: impl Into<String>) -> ResourceId
Registers an interrupt observation resource for event tapping.
Sourcepub fn build(self) -> Result<EmbeddedLabServer, ProviderError>
pub fn build(self) -> Result<EmbeddedLabServer, ProviderError>
Validates all registered resources and builds the EmbeddedLabServer.
Auto Trait Implementations§
impl !RefUnwindSafe for DriverLabBuilder
impl !UnwindSafe for DriverLabBuilder
impl Freeze for DriverLabBuilder
impl Send for DriverLabBuilder
impl Sync for DriverLabBuilder
impl Unpin for DriverLabBuilder
impl UnsafeUnpin for DriverLabBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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