Struct darkredis::CommandList[][src]

pub struct CommandList<'a> { /* fields omitted */ }

Struct for defining commands manually, which allows for pipelining of several commands. If you need to only run one command, use Command, which has almost the same API.

Example

use darkredis::{CommandList, Connection};
use futures::TryStreamExt; //for `try_collect`

let command = CommandList::new("LPUSH").arg(b"pipelined-list").arg(b"bar")
    .command("LTRIM").arg(b"pipelined-list").arg(b"0").arg(b"100");
let results = connection.run_commands(command).await.unwrap();

assert_eq!(results.try_collect::<Vec<Value>>().await.unwrap(), vec![Value::Integer(1), Value::Ok]);

Implementations

impl<'a> CommandList<'a>[src]

pub fn new(cmd: &'a str) -> Self[src]

Create a new command list starting with cmd.

pub fn arg<D>(self, data: &'a D) -> Self where
    D: AsRef<[u8]>, 
[src]

Consumes the command and appends an argument to it, builder style. Note that this will NOT create a new command for pipelining. That's what Commandlist::command is for.

See also

append_arg

pub fn args<D>(self, arguments: &'a [D]) -> Self where
    D: AsRef<[u8]>, 
[src]

Add multiple arguments from a slice, builder-style.

See also

append_args

pub fn command(self, cmd: &'a str) -> Self[src]

Add a command to be executed in a pipeline, builder-style. Calls to Command::arg will add arguments from now on.

See also

append_command

pub fn append_args<D>(&mut self, arguments: &'a [D]) where
    D: AsRef<[u8]>, 
[src]

Append arguments from a slice.

See also

args

pub fn append_arg<D>(&mut self, data: &'a D) where
    D: AsRef<[u8]>, 
[src]

Mutate self by adding an additional argument.

See also

arg

pub fn append_command(&mut self, cmd: &'a str)[src]

Append a new command to self.

See also

command

pub fn command_count(&self) -> usize[src]

Count the number of commands currently in the pipeline

Trait Implementations

impl<'a> Clone for CommandList<'a>[src]

impl<'a> Debug for CommandList<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for CommandList<'a>[src]

impl<'a> Send for CommandList<'a>[src]

impl<'a> Sync for CommandList<'a>[src]

impl<'a> Unpin for CommandList<'a>[src]

impl<'a> UnwindSafe for CommandList<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.