pub trait IpcClientExt: IpcClient {
// Provided methods
fn register_rpc_handler<H>(
&self,
handler: H,
) -> impl Future<Output = ()> + Send
where H: RpcHandler + Send + Sync + 'static { ... }
fn send_typed<Payload>(
&self,
payload: Payload,
destination: Endpoint,
) -> impl Future<Output = Result<(), RequestError>> + Send
where Payload: Serialize + PayloadTypeName + Send { ... }
fn broadcast_typed<Payload>(
&self,
payload: Payload,
group: BroadcastGroup,
) -> impl Future<Output = Result<Vec<EndpointSendResult>, BroadcastError>> + Send
where Payload: Serialize + PayloadTypeName + Send { ... }
fn subscribe_typed<Payload>(
&self,
) -> impl Future<Output = Result<IpcClientTypedSubscription<Payload>, SubscribeError>> + Send
where Payload: DeserializeOwned + PayloadTypeName { ... }
fn request<Request>(
&self,
request: Request,
destination: Endpoint,
cancellation_token: Option<CancellationToken>,
) -> impl Future<Output = Result<Request::Response, RequestError>> + Send
where Request: RpcRequest + Send,
Request::Response: Send { ... }
}Expand description
Provided Methods§
Sourcefn register_rpc_handler<H>(&self, handler: H) -> impl Future<Output = ()> + Send
fn register_rpc_handler<H>(&self, handler: H) -> impl Future<Output = ()> + Send
Register a new RPC handler for processing incoming RPC requests. The handler will be executed by the IPC client when an RPC request is received and the response will be sent back over IPC.
Sourcefn send_typed<Payload>(
&self,
payload: Payload,
destination: Endpoint,
) -> impl Future<Output = Result<(), RequestError>> + Send
fn send_typed<Payload>( &self, payload: Payload, destination: Endpoint, ) -> impl Future<Output = Result<(), RequestError>> + Send
Send a message with a payload of any serializable type to the specified destination.
Sourcefn broadcast_typed<Payload>(
&self,
payload: Payload,
group: BroadcastGroup,
) -> impl Future<Output = Result<Vec<EndpointSendResult>, BroadcastError>> + Send
fn broadcast_typed<Payload>( &self, payload: Payload, group: BroadcastGroup, ) -> impl Future<Output = Result<Vec<EndpointSendResult>, BroadcastError>> + Send
Send a message with a payload of any serializable type to every member of group. See
IpcClient::broadcast for how the group is resolved and how failures are reported.
Sourcefn subscribe_typed<Payload>(
&self,
) -> impl Future<Output = Result<IpcClientTypedSubscription<Payload>, SubscribeError>> + Sendwhere
Payload: DeserializeOwned + PayloadTypeName,
fn subscribe_typed<Payload>(
&self,
) -> impl Future<Output = Result<IpcClientTypedSubscription<Payload>, SubscribeError>> + Sendwhere
Payload: DeserializeOwned + PayloadTypeName,
Create a subscription to receive messages that can be deserialized into the provided payload type.
Sourcefn request<Request>(
&self,
request: Request,
destination: Endpoint,
cancellation_token: Option<CancellationToken>,
) -> impl Future<Output = Result<Request::Response, RequestError>> + Send
fn request<Request>( &self, request: Request, destination: Endpoint, cancellation_token: Option<CancellationToken>, ) -> impl Future<Output = Result<Request::Response, RequestError>> + Send
Send a request to the specified destination and wait for a response. The destination must have a registered RPC handler for the request type, otherwise an error will be returned by the remote endpoint.
The response is accepted only from destination, as identified by the source the
transport reports for each incoming message (the SDK trusts the transport, and any relay
in between, to label sources correctly). A response from any other source is ignored, so a
caller that needs a bound on the wait should pass a cancellation_token.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".