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<S::Proxy, Error>
pub async fn watch_for_any(self) -> Result<S::Proxy, 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,
Returns a new Service
that waits for instances to appear in
the given service directory, probably opened by open_service
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
Source§fn from(dir: DirectoryProxy) -> Self
fn from(dir: DirectoryProxy) -> Self
Auto Trait Implementations§
impl<S> Freeze for Service<S>where
S: Freeze,
impl<S> !RefUnwindSafe for Service<S>
impl<S> Send for Service<S>where
S: Send,
impl<S> Sync for Service<S>where
S: Sync,
impl<S> Unpin for Service<S>where
S: Unpin,
impl<S> !UnwindSafe for Service<S>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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