Struct rustis::client::PreparedCommand

source ·
pub struct PreparedCommand<'a, E, R = ()>
where R: Response,
{ pub executor: E, pub command: Command, pub custom_converter: Option<Box<dyn Fn(RespBuf, Command, &'a Client) -> Future<'a, R> + Send + Sync>>, pub retry_on_error: Option<bool>, /* private fields */ }
Expand description

Wrapper around a command about to be send with a marker for the response type and a few options to decide how the response send back by Redis should be processed.

Fields§

§executor: E

Client, Transaction or Pipeline that will actually send the command to the Redis server.

§command: Command

Command to send

§custom_converter: Option<Box<dyn Fn(RespBuf, Command, &'a Client) -> Future<'a, R> + Send + Sync>>

Custom converter to transform a RESP Buffer in to R type

§retry_on_error: Option<bool>

Flag to retry sending the command on network error.

Implementations§

source§

impl<'a, E, R> PreparedCommand<'a, E, R>
where R: Response,

source

pub fn new(executor: E, command: Command) -> Self

Create a new prepared command.

source

pub fn custom_converter( self, custom_converter: Box<dyn Fn(RespBuf, Command, &'a Client) -> Future<'a, R> + Send + Sync> ) -> Self

Set the functor [self.custom_converter]

source

pub fn retry_on_error(self, retry_on_error: bool) -> Self

Set a flag to override default retry_on_error behavior.

See Config::retry_on_error

source

pub fn command(&self) -> &Command

Get a reference to the command to send

Trait Implementations§

source§

impl<'a, 'b, R: Response> BatchPreparedCommand for PreparedCommand<'a, &'a mut Pipeline<'b>, R>

source§

fn queue(self)

Queue a command.

source§

fn forget(self)

Queue a command and forget its response.

source§

impl<'a, R: Response> BatchPreparedCommand for PreparedCommand<'a, &'a mut Transaction, R>

source§

fn queue(self)

Queue a command into the transaction.

source§

fn forget(self)

Queue a command into the transaction and forget its response.

source§

impl<'a, R: Response> ClientPreparedCommand<'a, R> for PreparedCommand<'a, &'a Client, R>

source§

fn forget(self) -> Result<()>

Send command and forget its response

§Errors

Any Redis driver Error that occur during the send operation

source§

impl<'a, R> IntoFuture for PreparedCommand<'a, &'a Client, R>
where R: DeserializeOwned + Send + 'a,

§

type Output = Result<R, Error>

The output that the future will produce on completion.
§

type IntoFuture = Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'a>>

Which kind of future are we turning this into?
source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more
source§

impl<'a, R> IntoFuture for PreparedCommand<'a, &'a mut Connection, R>
where R: DeserializeOwned + Send + 'a,

§

type Output = Result<R, Error>

The output that the future will produce on completion.
§

type IntoFuture = Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'a>>

Which kind of future are we turning this into?
source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more
source§

impl<'a, R> IntoFuture for PreparedCommand<'a, &'a mut StandaloneConnection, R>
where R: DeserializeOwned + Send + 'a,

§

type Output = Result<R, Error>

The output that the future will produce on completion.
§

type IntoFuture = Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'a>>

Which kind of future are we turning this into?
source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more

Auto Trait Implementations§

§

impl<'a, E, R> Freeze for PreparedCommand<'a, E, R>
where E: Freeze,

§

impl<'a, E, R = ()> !RefUnwindSafe for PreparedCommand<'a, E, R>

§

impl<'a, E, R> Send for PreparedCommand<'a, E, R>
where E: Send, R: Send,

§

impl<'a, E, R> Sync for PreparedCommand<'a, E, R>
where E: Sync, R: Sync,

§

impl<'a, E, R> Unpin for PreparedCommand<'a, E, R>
where E: Unpin, R: Unpin,

§

impl<'a, E, R = ()> !UnwindSafe for PreparedCommand<'a, E, R>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more