Skip to main content

Request

Trait Request 

Source
pub trait Request<P: Protocol> {
    type Response;
    type Error: From<ClientError>;

    // Required methods
    fn message(&self) -> Result<EncodedMessage, Self::Error>;
    fn decode(&self, message: Message) -> Result<Self::Response, Self::Error>;
}
Expand description

Pair a prepared protocol request with checked terminal-response decoding.

Application errors belong to the implementation, so they can retain an original peer error or legacy JSON response rather than flattening it into a generic transport error. Implementations borrow prepared inputs.

Required Associated Types§

Source

type Response

Checked operation result, independent of SDK domain behavior.

Source

type Error: From<ClientError>

Application error that can also retain a local transport failure.

Required Methods§

Source

fn message(&self) -> Result<EncodedMessage, Self::Error>

Encode the prepared request without performing I/O.

Source

fn decode(&self, message: Message) -> Result<Self::Response, Self::Error>

Check the expected terminal response name, generation, and payload.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§