Struct darkredis::CommandList [−][src]
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]
D: AsRef<[u8]>,
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
pub fn args<D>(self, arguments: &'a [D]) -> Self where
D: AsRef<[u8]>,
[src]
D: AsRef<[u8]>,
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
pub fn append_args<D>(&mut self, arguments: &'a [D]) where
D: AsRef<[u8]>,
[src]
D: AsRef<[u8]>,
pub fn append_arg<D>(&mut self, data: &'a D) where
D: AsRef<[u8]>,
[src]
D: AsRef<[u8]>,
pub fn append_command(&mut self, cmd: &'a str)
[src]
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]
fn clone(&self) -> CommandList<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,