[][src]Struct darkredis::CommandList

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

A 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

#![feature(async_await)]
use darkredis::{CommandList, Connection};

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, vec![Value::Integer(1), Value::Ok]);

Methods

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

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

Create a new command from cmd.

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

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

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

Add multiple arguments from a slice.

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

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

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

Count the number of commands currently in the pipeline

Auto Trait Implementations

impl<'a> Sync for CommandList<'a>

impl<'a> Send for CommandList<'a>

impl<'a> Unpin for CommandList<'a>

impl<'a> RefUnwindSafe for CommandList<'a>

impl<'a> UnwindSafe for CommandList<'a>

Blanket Implementations

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

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

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.

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

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

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

impl<T> Erased for T