[−][src]Struct darkredis::CommandList
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]
D: AsRef<[u8]>,
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]
D: AsRef<[u8]>,
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]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,