pub struct Service<S> { /* private fields */ }
Expand description
A service from an incoming namespace’s /svc
directory.
Implementations§
Source§impl<S: ServiceMarker> Service<S>
impl<S: ServiceMarker> Service<S>
Sourcepub fn from_service_dir_proxy(dir: DirectoryProxy, _marker: S) -> Self
pub fn from_service_dir_proxy(dir: DirectoryProxy, _marker: S) -> Self
Returns a new Service
that waits for instances to appear in
the given service directory, probably opened by open_service
Sourcepub fn open(marker: S) -> Result<Self, Error>
pub fn open(marker: S) -> Result<Self, Error>
Returns a new Service
from the process’s incoming service namespace.
Sourcepub fn open_from_dir(
svc_dir: impl AsRefDirectory,
marker: S,
) -> Result<Self, Error>
pub fn open_from_dir( svc_dir: impl AsRefDirectory, marker: S, ) -> Result<Self, Error>
Returns a new Service
that is in the given directory.
Sourcepub fn open_from_dir_prefix(
dir: impl AsRefDirectory,
prefix: impl AsRef<str>,
marker: S,
) -> Result<Self, Error>
pub fn open_from_dir_prefix( dir: impl AsRefDirectory, prefix: impl AsRef<str>, marker: S, ) -> Result<Self, Error>
Sourcepub fn connect_to_instance(
&self,
name: impl AsRef<str>,
) -> Result<S::Proxy, Error>
pub fn connect_to_instance( &self, name: impl AsRef<str>, ) -> Result<S::Proxy, Error>
Connects to the named instance without waiting for it to appear. You should only use this
after the instance name has been returned by the Self::watch
stream, or if the
instance is statically routed so component manager will lazily load it.
Sourcepub async fn watch(&self) -> Result<ServiceInstanceStream<'_, S>, Error>
pub async fn watch(&self) -> Result<ServiceInstanceStream<'_, S>, Error>
Returns an async stream of service instances that are enumerated within this service directory.
Sourcepub async fn watch_for_any(&self) -> Result<ServiceInstance<'_, S>, Error>
pub async fn watch_for_any(&self) -> Result<ServiceInstance<'_, S>, Error>
Asynchronously returns the first service instance available within this service directory.
Trait Implementations§
Source§impl<S> From<DirectoryProxy> for Service<S>where
S: Default,
impl<S> From<DirectoryProxy> for Service<S>where
S: Default,
Returns a new Service
that waits for instances to appear in
the given service directory, probably opened by open_service