pub trait Command<F> {
type Response;
// Required methods
fn encode(&self) -> F;
fn eval_response(
&self,
frame: F,
) -> Result<Self::Response, ResponseTypeError>;
}Expand description
Generic command structure. F is either Resp2Frame or Resp3Frame
Required Associated Types§
Required Methods§
Sourcefn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
fn eval_response(&self, frame: F) -> Result<Self::Response, ResponseTypeError>
The command has the ability to evaluate the response frame and craft its own high level response from that. Its also possible to just return 1:1 the RESP2 frame.
Error responses are captured upfront and converted to CommandErrors::ErrorResponse. So error responses never reach that method.
Returns Error only in case of protocol violation (e.g. received an array for an command that only returns strings)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".