Skip to main content

run_client

Function run_client 

Source
pub fn run_client<D, C>(
    dialer: D,
    codec: C,
    config: ClientConfig,
    clock: Arc<dyn RuntimeOps>,
) -> (ClientHandle, BoxFut<'static, ()>)
where D: Dialer + 'static, C: EnvelopeCodec + 'static,
Expand description

Build the client engine: returns a ClientHandle for issuing RPC and the engine future to drive on the runner (spawn-free). The future runs until all ClientHandle clones are dropped (graceful stop) — or, with ClientConfig::reconnect off, until the first disconnect.

clock is the adapter’s dyn-safe RuntimeOps (e.g. db.runtime_ops()); the engine uses it for the reconnect backoff and keepalive — the only runtime dependency, so the rest of the engine is runtime-neutral.