pub struct ClientHandle { /* private fields */ }Expand description
A cheap-clone handle to a running run_client engine — the caller-facing
RPC surface. Every method funnels a command to the engine, which owns the
pending-call map and the wire.
Implementations§
Source§impl ClientHandle
impl ClientHandle
Sourcepub async fn call(
&self,
method: impl Into<String>,
params: Payload,
) -> Result<Payload, RpcError>
pub async fn call( &self, method: impl Into<String>, params: Payload, ) -> Result<Payload, RpcError>
One-shot RPC: send a request and await its single reply. Returns
RpcError::Internal if the engine has stopped or the connection drops
before the reply arrives.
Cancel-safe: dropping this future (a timeout losing the race, an aborted task) releases the engine’s pending-call entry rather than leaving it until the connection ends.
Sourcepub fn subscribe(
&self,
topic: impl Into<String>,
) -> Result<BoxStream<'static, Result<SubUpdate, RpcError>>, RpcError>
pub fn subscribe( &self, topic: impl Into<String>, ) -> Result<BoxStream<'static, Result<SubUpdate, RpcError>>, RpcError>
Open a subscription; returns the stream of updates immediately (the engine
sends the Subscribe request asynchronously). Dropping the stream stops
local delivery. The stream is not re-subscribed on reconnect (see
ClientConfig::reconnect) — re-call to resume.
Each item is Ok(SubUpdate) for a delivered update, carrying the
concrete record topic when the server tags it (wildcard subscriptions fan
in many records under this one stream). A server rejection surfaces as a
terminal Err(RpcError) item, letting the caller distinguish a
denied subscription (do not retry) from a disconnect-shaped stream end
(retry to resume).
Late-join snapshots arrive first, the last of them flagged
SubUpdate::snapshot_end with the burst’s total loss in skipped (see
Session::snapshots). Read that flag to
close out the initial state, but drive the stream normally rather than
looping until it: a subscription matching no records never emits one,
and neither does one whose final snapshot frame was lost — the stream
stays open and simply proceeds to live events.
Trait Implementations§
Source§impl Clone for ClientHandle
impl Clone for ClientHandle
Source§fn clone(&self) -> ClientHandle
fn clone(&self) -> ClientHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more