Struct 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, R: Response> BatchPreparedCommand for PreparedCommand<'a, &'a mut Pipeline<'_>, 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,

Source§

type Output = Result<R, Error>

The output that the future will produce on completion.
Source§

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,

Source§

type Output = Result<R, Error>

The output that the future will produce on completion.
Source§

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,

Source§

type Output = Result<R, Error>

The output that the future will produce on completion.
Source§

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, 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

Source§

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> ErasedDestructor for T
where T: 'static,