Skip to main content

Dispatch

Type Alias Dispatch 

Source
pub type Dispatch<Req = UntypedMessage, Notif = UntypedMessage> = Dispatch<Req, Notif, V2>;
Available on crate feature unstable_protocol_v2 only.
Expand description

A message received by a typed handler on a v2 Builder: the Dispatch with v2 request handles.

Aliased Type§

pub enum Dispatch<Req = UntypedMessage, Notif = UntypedMessage> {
    Request(Req, Responder<<Req as JsonRpcRequest>::Response, V2>),
    Notification(Notif),
    Response(Result<<Req as JsonRpcRequest>::Response, Error>, ResponseRouter<<Req as JsonRpcRequest>::Response, V2>),
}

Variants§

§

Request(Req, Responder<<Req as JsonRpcRequest>::Response, V2>)

Incoming request and the context where the response should be sent.

§

Notification(Notif)

Incoming notification.

§

Response(Result<<Req as JsonRpcRequest>::Response, Error>, ResponseRouter<<Req as JsonRpcRequest>::Response, V2>)

Incoming response to a request we sent.

The first field is the response result (success or error from the remote). The second field is the context for forwarding the response to its destination (typically a waiting oneshot channel).