Skip to main content

ClientLifecycle

Trait ClientLifecycle 

Source
pub trait ClientLifecycle: MaybeSendSync {
    // Provided methods
    fn install<'a>(&'a self, _client: Weak<Client>) -> BoxFuture<'a, Result<()>> { ... }
    fn on_ready<'a>(
        &'a self,
        _scope: ConnectionScope,
    ) -> BoxFuture<'a, Result<()>> { ... }
    fn on_closed<'a>(
        &'a self,
        _scope: ConnectionScope,
    ) -> BoxFuture<'a, Result<()>> { ... }
    fn signal_shutdown(&self) { ... }
    fn shutdown(&self) -> BoxFuture<'_, Result<()>> { ... }
}
Available on crate feature client-lifecycle only.
Expand description

Aggregate lifecycle seam installed during Client construction.

Implementations must make install transactional. Connection callbacks are serialized, with bounded ready work; connection cleanup only schedules on_closed so a stalled extension cannot block reconnect. Closure callbacks are lossless and may temporarily exceed the target capacity. A future plugin host owns per-plugin ordering and isolation behind this client-level seam. install receives a weak client reference so retaining it cannot create a cycle. signal_shutdown is the non-blocking boundary for resources that must stop even when an FFI host cannot await shutdown.

Provided Methods§

Source

fn install<'a>(&'a self, _client: Weak<Client>) -> BoxFuture<'a, Result<()>>

Source

fn on_ready<'a>(&'a self, _scope: ConnectionScope) -> BoxFuture<'a, Result<()>>

Source

fn on_closed<'a>(&'a self, _scope: ConnectionScope) -> BoxFuture<'a, Result<()>>

Source

fn signal_shutdown(&self)

Stop synchronously owned resources before asynchronous shutdown begins. Implementations must return promptly and make repeated calls harmless.

Source

fn shutdown(&self) -> BoxFuture<'_, Result<()>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§