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§

source

type Response

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

Required Methods§

source

fn encode(&self) -> F

Encodes the command to RESP2/RESP3 frame

source

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)

Implementors§

source§

impl Command<Frame> for HelloCommand

source§

impl Command<Frame> for HelloCommand

source§

impl<F> Command<F> for AuthCommand

§

type Response = ()

source§

impl<F> Command<F> for CustomCommand
where F: From<CommandBuilder>,

§

type Response = F

source§

impl<F> Command<F> for GetCommand

source§

impl<F> Command<F> for HashGetCommand

source§

impl<F> Command<F> for HashGetAllCommand

source§

impl<F> Command<F> for PingCommand

§

type Response = ()

source§

impl<F> Command<F> for PublishCommand

source§

impl<F> Command<F> for SetCommand<ConfirmationResponse>

§

type Response = ()

source§

impl<F> Command<F> for SetCommand<ExclusiveSetResponse>

source§

impl<F> Command<F> for SetCommand<ReturnPreviousResponse>

source§

impl<F: From<CommandBuilder> + ToInteger, const N: usize> Command<F> for HashSetCommand<N>

source§

impl<F: From<CommandBuilder>> Command<F> for BackgroundSaveCommand

§

type Response = ()