pub struct ServiceBindingScope { /* private fields */ }Expand description
Registration scope passed to a driver’s bind callback for a discovered FIDL service instance.
Devices registered through Self::add_scoped_device and cleanup callbacks registered via
Self::on_disconnect are tied to the lifetime of the service instance and any channel
passed to Self::monitor_channel (later calls overwrite any previously monitored channel).
When a monitored channel observes ZX_CHANNEL_PEER_CLOSED, or when the service instance
directory entry is removed or replaced in /svc/<S::SERVICE_NAME>, the watcher runs all
registered teardown hooks and device removals in reverse registration order on the kernel’s
main async executor.
Implementations§
Source§impl ServiceBindingScope
impl ServiceBindingScope
Sourcepub fn monitor_channel<P: SynchronousProxy + Send + Sync + 'static>(
&mut self,
proxy: Arc<P>,
)
pub fn monitor_channel<P: SynchronousProxy + Send + Sync + 'static>( &mut self, proxy: Arc<P>, )
Retains proxy for the duration of the binding and monitors its underlying Zircon
channel for ZX_CHANNEL_PEER_CLOSED, running all registered teardown hooks when the
remote peer closes its endpoint.
Sourcepub fn on_disconnect(
&mut self,
hook: impl FnOnce(&CurrentTask) + Send + 'static,
)
pub fn on_disconnect( &mut self, hook: impl FnOnce(&CurrentTask) + Send + 'static, )
Registers hook to be invoked on the kernel’s main async executor with
KernelThreads::system_task when the binding
disconnects, executing in reverse registration order relative to other hooks and scoped
devices.
Sourcepub fn add_scoped_device(&mut self, device: Device) -> Device
pub fn add_scoped_device(&mut self, device: Device) -> Device
Registers a disconnect hook that removes device via
DeviceRegistry::remove_device when the
binding disconnects, returning device.
Trait Implementations§
Source§impl Debug for ServiceBindingScope
impl Debug for ServiceBindingScope
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceBindingScope
impl !Sync for ServiceBindingScope
impl !UnwindSafe for ServiceBindingScope
impl Freeze for ServiceBindingScope
impl Send for ServiceBindingScope
impl Unpin for ServiceBindingScope
impl UnsafeUnpin for ServiceBindingScope
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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]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