pub struct MountContext { /* private fields */ }Expand description
Context threaded into a MountFactory to build a service’s mount.
A MountFactory::construct is a plain fn pointer (inventory constraint) and
therefore cannot capture the per-process transport/identity state a
GenericServiceMount needs — an Arc<dyn RpcClient> and the shared
StreamRegistry. MountContext
carries that state, mirroring how [ServiceFactory]’s fn(&ServiceContext)
threads spawn-time state. It resolves an Arc<dyn RpcClient> per service by
name via the caller-supplied dial closure (which owns the signing key +
trust-store lookup), so this crate stays free of identity/config types.
Implementations§
Source§impl MountContext
impl MountContext
Sourcepub fn new(
dial: impl Fn(&str) -> Result<Arc<dyn RpcClient>> + Send + Sync + 'static,
) -> Self
pub fn new( dial: impl Fn(&str) -> Result<Arc<dyn RpcClient>> + Send + Sync + 'static, ) -> Self
Build a context from a per-service client dialer. The stream_registry
is created fresh; use with_stream_registry
to share one across builders.
Sourcepub fn with_stream_registry(self, stream_registry: Arc<StreamRegistry>) -> Self
pub fn with_stream_registry(self, stream_registry: Arc<StreamRegistry>) -> Self
Use an existing shared [StreamRegistry] instead of a fresh one.
Sourcepub fn stream_registry(&self) -> &Arc<StreamRegistry>
pub fn stream_registry(&self) -> &Arc<StreamRegistry>
The shared stream registry these mounts publish into.
Auto Trait Implementations§
impl Freeze for MountContext
impl !RefUnwindSafe for MountContext
impl Send for MountContext
impl Sync for MountContext
impl Unpin for MountContext
impl UnsafeUnpin for MountContext
impl !UnwindSafe for MountContext
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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