pub trait Link: Send + Sync {
// Required methods
fn call(
&self,
path: &str,
input: Value,
) -> impl Future<Output = Result<Value, ClientError>> + Send;
fn subscribe(
&self,
path: &str,
input: Value,
last_event_id: Option<u64>,
) -> impl Future<Output = Result<ValueStream, ClientError>> + Send;
}Expand description
Transport abstraction for oRPC client calls.
Mirrors the TypeScript Link interface from @orpc/client.
Implementors handle the actual HTTP (or IPC) communication.
Use RpcLink for the standard HTTP RPC transport.
Required Methods§
Sourcefn call(
&self,
path: &str,
input: Value,
) -> impl Future<Output = Result<Value, ClientError>> + Send
fn call( &self, path: &str, input: Value, ) -> impl Future<Output = Result<Value, ClientError>> + Send
Execute a single-value RPC call (query or mutation).
Sourcefn subscribe(
&self,
path: &str,
input: Value,
last_event_id: Option<u64>,
) -> impl Future<Output = Result<ValueStream, ClientError>> + Send
fn subscribe( &self, path: &str, input: Value, last_event_id: Option<u64>, ) -> impl Future<Output = Result<ValueStream, ClientError>> + Send
Execute a subscription RPC call, returning an SSE stream of values.
If last_event_id is provided, the server resumes from that event
(SSE reconnection via Last-Event-ID header).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.