pub struct ServiceWatcher<S: ServiceMarker>(/* private fields */);Expand description
Per-Kernel manager that watches /svc/<S::SERVICE_NAME> at most once and fans out
discovered ServiceMarker::Proxy instances to registered Starnix drivers.
Active instances are retained so drivers registered after initial discovery still receive
previously discovered live instances, and each bound instance can register devices and
disconnect hooks on a ServiceBindingScope that are automatically torn down when a monitored
channel closes or when the service instance directory entry is removed or replaced.
Implementations§
Source§impl<S: ServiceMarker<Proxy: Send + Sync + 'static>> ServiceWatcher<S>
impl<S: ServiceMarker<Proxy: Send + Sync + 'static>> ServiceWatcher<S>
Sourcepub fn register<Bind>(kernel: &Kernel, marker: S, bind: Bind)
pub fn register<Bind>(kernel: &Kernel, marker: S, bind: Bind)
Registers a driver that binds each discovered service instance on the kernel’s main async executor.
Sourcepub fn register_singleton<Bind>(kernel: &Kernel, marker: S, bind: Bind)
pub fn register_singleton<Bind>(kernel: &Kernel, marker: S, bind: Bind)
Registers a singleton driver that binds at most one service instance at a time on the kernel’s main async executor, ignoring additional instances while bound and promoting a remaining active instance if the bound instance disconnects.
Sourcepub fn register_with_probe<P, Probe, ProbeFut, Bind>(
kernel: &Kernel,
marker: S,
probe: Probe,
bind: Bind,
)
pub fn register_with_probe<P, Probe, ProbeFut, Bind>( kernel: &Kernel, marker: S, probe: Probe, bind: Bind, )
Registers a driver that probes each discovered service instance asynchronously (without
holding kernel locks) and, when probe returns Some(probed), invokes bind on the
kernel’s main async executor with
KernelThreads::system_task and a
ServiceBindingScope.
probe futures may run concurrently across instances, whereas bind and teardown
invocations are serialized per driver after synchronously tearing down any stale bindings.
Any active service instances discovered before this call are replayed to the driver on the
kernel’s main async executor.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for ServiceWatcher<S>where
PhantomData<S>: Freeze,
impl<S> RefUnwindSafe for ServiceWatcher<S>where
PhantomData<S>: RefUnwindSafe,
impl<S> Send for ServiceWatcher<S>where
PhantomData<S>: Send,
impl<S> Sync for ServiceWatcher<S>where
PhantomData<S>: Sync,
impl<S> Unpin for ServiceWatcher<S>where
PhantomData<S>: Unpin,
impl<S> UnsafeUnpin for ServiceWatcher<S>where
PhantomData<S>: UnsafeUnpin,
impl<S> UnwindSafe for ServiceWatcher<S>where
PhantomData<S>: UnwindSafe,
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