quic_rpc

Trait Service

Source
pub trait Service:
    Send
    + Sync
    + Debug
    + Clone
    + 'static {
    type Req: RpcMessage;
    type Res: RpcMessage;
}
Expand description

A service

A service has request and response message types. These types have to be the union of all possible request and response types for all interactions with the service.

Usually you will define an enum for the request and response type, and use the derive_more crate to define the conversions between the enum and the actual request and response types.

To make a message type usable as a request for a service, implement message::Msg for it. This is how you define the interaction patterns for each request type.

Depending on the interaction type, you might need to implement traits that further define details of the interaction.

A message type can be used for multiple services. E.g. you might have a Status request that is understood by multiple services and returns a standard status response.

Required Associated Types§

Source

type Req: RpcMessage

Type of request messages

Source

type Res: RpcMessage

Type of response messages

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.

Implementors§