[−][src]Struct deadpool_redis::Cmd
Wrapper for redis::Cmd
which makes it compatible with the query_async
method which takes a ConnectionLike
as argument.
This Implementation could be simplified a lot via RFC 2393.
See redis::Cmd
Implementations
impl Cmd
[src]
pub fn new() -> Self
[src]
See redis::Cmd::new
pub fn arg<T: ToRedisArgs>(&mut self, arg: T) -> &mut Cmd
[src]
See redis::Cmd::arg
pub fn cursor_arg(&mut self, cursor: u64) -> &mut Cmd
[src]
pub async fn query_async<'_, '_, T: FromRedisValue + Send>(
&'_ self,
conn: &'_ mut ConnectionWrapper
) -> RedisResult<T>
[src]
&'_ self,
conn: &'_ mut ConnectionWrapper
) -> RedisResult<T>
pub async fn execute_async<'_, '_>(
&'_ self,
con: &'_ mut ConnectionWrapper
) -> RedisResult<()>
[src]
&'_ self,
con: &'_ mut ConnectionWrapper
) -> RedisResult<()>
Methods from Deref<Target = Cmd>
pub fn arg<T>(&mut self, arg: T) -> &mut Cmd where
T: ToRedisArgs,
[src]
T: ToRedisArgs,
Appends an argument to the command. The argument passed must
be a type that implements ToRedisArgs
. Most primitive types as
well as vectors of primitive types implement it.
For instance all of the following are valid:
redis::cmd("SET").arg(&["my_key", "my_value"]); redis::cmd("SET").arg("my_key").arg(42); redis::cmd("SET").arg("my_key").arg(b"my_value");
pub fn cursor_arg(&mut self, cursor: u64) -> &mut Cmd
[src]
Works similar to arg
but adds a cursor argument. This is always
an integer and also flips the command implementation to support a
different mode for the iterators where the iterator will ask for
another batch of items when the local data is exhausted.
let mut cmd = redis::cmd("SSCAN"); let mut iter : redis::Iter<isize> = cmd.arg("my_set").cursor_arg(0).clone().iter(&mut con).unwrap(); for x in iter { // do something with the item }
pub fn get_packed_command(&self) -> Vec<u8>
[src]
Returns the packed command as a byte vector.
pub fn in_scan_mode(&self) -> bool
[src]
Returns true if the command is in scan mode.
pub fn query<T>(&self, con: &mut dyn ConnectionLike) -> Result<T, RedisError> where
T: FromRedisValue,
[src]
T: FromRedisValue,
Sends the command as query to the connection and converts the result to the target redis value. This is the general way how you can retrieve data.
pub async fn query_async<C, T>(
&'_ self,
con: &'_ mut C
) -> Result<T, RedisError> where
C: ConnectionLike,
T: FromRedisValue,
[src]
&'_ self,
con: &'_ mut C
) -> Result<T, RedisError> where
C: ConnectionLike,
T: FromRedisValue,
Async version of query
.
pub fn execute(&self, con: &mut dyn ConnectionLike)
[src]
This is a shortcut to query()
that does not return a value and
will fail the task if the query fails because of an error. This is
mainly useful in examples and for simple commands like setting
keys.
This is equivalent to a call of query like this:
let _ : () = redis::cmd("PING").query(&mut con).unwrap();
pub fn args_iter(
&self
) -> impl Clone + ExactSizeIterator + Iterator<Item = Arg<&[u8]>>
[src]
&self
) -> impl Clone + ExactSizeIterator + Iterator<Item = Arg<&[u8]>>
Returns an iterator over the arguments in this command (including the command name itself)
Trait Implementations
impl Deref for Cmd
[src]
impl DerefMut for Cmd
[src]
impl From<Cmd> for Cmd
[src]
impl Into<Cmd> for Cmd
[src]
Auto Trait Implementations
impl RefUnwindSafe for Cmd
impl Send for Cmd
impl Sync for Cmd
impl Unpin for Cmd
impl UnwindSafe for Cmd
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,