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§
Sourcetype Error: From<ClientError>
type Error: From<ClientError>
Application error that can also retain a local transport failure.
Required Methods§
Sourcefn message(&self) -> Result<EncodedMessage, Self::Error>
fn message(&self) -> Result<EncodedMessage, Self::Error>
Encode the prepared request without performing I/O.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".