pub struct Registar<M = ()> { /* private fields */ }Expand description
The Registar manages immutable runtime service registrations.
Implementations§
Source§impl<M> Registar<M>
impl<M> Registar<M>
Sourcepub fn give_form(&self) -> ServiceRegistrationForm<M>
pub fn give_form(&self) -> ServiceRegistrationForm<M>
Returns a capability to register one service.
Sourcepub async fn deregister(
&self,
service_binding: &ServiceBinding,
) -> Option<RegisteredService<M>>
pub async fn deregister( &self, service_binding: &ServiceBinding, ) -> Option<RegisteredService<M>>
Removes the registration for a final binding and returns it.
Returns None when no service is registered with that binding. A
service that stops should remove its own registration, so the same
binding can be registered again, for example when a stopped test
environment restarts on a fixed port.
The registry is keyed by binding only, so this removes whichever registration holds that binding. Callers should pass only a binding they registered themselves.
Sourcepub async fn services(&self) -> Vec<RegisteredService<M>>where
M: Clone,
pub async fn services(&self) -> Vec<RegisteredService<M>>where
M: Clone,
Returns a deterministic, side-effect-free snapshot of all services.
Results are ordered by protocol, then final socket address, never by insertion or hash-map iteration order.
Sourcepub async fn services_matching<F>(
&self,
predicate: F,
) -> Vec<RegisteredService<M>>
pub async fn services_matching<F>( &self, predicate: F, ) -> Vec<RegisteredService<M>>
Returns a deterministic, side-effect-free metadata query result.