pub trait Command<F> {
    type Response;

    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

Response type, either a custom evaluated “high-level” response or the original RESP frame

Required Methods

Encodes the command to RESP2/RESP3 frame

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)

Implementors