Trait embedded_redis::commands::Command
source · 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
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)