Skip to main content

ClientHandle

Struct ClientHandle 

Source
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

Source

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.

Source

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.

Source

pub fn write( &self, topic: impl Into<String>, payload: Payload, ) -> Result<(), RpcError>

Fire-and-forget write to a remote topic (no reply).

Trait Implementations§

Source§

impl Clone for ClientHandle

Source§

fn clone(&self) -> ClientHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.