Struct RedisCommand

Source
pub struct RedisCommand { /* private fields */ }
Expand description

A RedisCommand purpose is to build redis commands. It can contains one or more commands for pipelining

Example:

let cmd = &mut redis_client::RedisCommand::new();
cmd.set("key", "value2").get("key");

or its equivalent:

let cmd = &mut redis_client::RedisCommand::new();
cmd.add_cmd("SET").add_arg("key").add_arg("value2").end().add_cmd("GET").add_arg("key").end();

Implementations§

Source§

impl RedisCommand

Source

pub fn new() -> RedisCommand

Source

pub fn add_cmd<C>(&mut self, command: C) -> &mut RedisCommand
where C: ToString,

Add a string representing the command (APPEND, GET, SET…) to the command. (Each command should start with this method)

Source

pub fn add_arg<A>(&mut self, arg: A) -> &mut RedisCommand
where A: ToString,

Add a whitespace and a string to the commands

Source

pub fn add_args<A>(&mut self, args: Vec<A>) -> &mut RedisCommand
where A: ToString,

Add a whitespace and a string for each one of the vector’s items to the commands

Source

pub fn add_arg_map<F: ToString>( &mut self, args: HashMap<String, F>, ) -> &mut RedisCommand

Add a whitespace a key another whitespace and the value for each pair of the hash map to the curent command

Source

pub fn add_binary_arg(&mut self, arg: &[u8]) -> &mut RedisCommand

Add a whitespace and then an array of byte to the command

Source

pub fn end(&mut self) -> &mut RedisCommand

Teminate a command

Source

pub fn get_command_nb(&self) -> usize

Get the number of commands in the RedisCommand object

Trait Implementations§

Source§

impl CommandBuilder for RedisCommand

Source§

fn append<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn auth<P: ToString>(&mut self, password: P) -> &mut RedisCommand

Source§

fn bgrewriteaof(&mut self) -> &mut RedisCommand

Source§

fn bgsave(&mut self) -> &mut RedisCommand

Source§

fn bitcount<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn bitcount_range<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand

Source§

fn blpop<K: ToString>(&mut self, key: K, timeout: u32) -> &mut RedisCommand

Source§

fn mblpop<K: ToString>( &mut self, keys: Vec<K>, timeout: u32, ) -> &mut RedisCommand

Source§

fn brpop<K: ToString>(&mut self, key: K, timeout: u32) -> &mut RedisCommand

Source§

fn mbrpop<K: ToString>( &mut self, keys: Vec<K>, timeout: u32, ) -> &mut RedisCommand

Source§

fn brpoplpush<S: ToString, D: ToString>( &mut self, source: S, dest: D, timeout: u32, ) -> &mut RedisCommand

Source§

fn decr<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn decrby<K: ToString>(&mut self, key: K, increment: i64) -> &mut RedisCommand

Source§

fn del<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn mdel<K: ToString>(&mut self, keys: Vec<K>) -> &mut RedisCommand

Source§

fn discard(&mut self) -> &mut RedisCommand

Source§

fn echo<K: ToString>(&mut self, msg: K) -> &mut RedisCommand

Source§

fn exec(&mut self) -> &mut RedisCommand

Source§

fn exists<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn mexists<K: ToString>(&mut self, keys: Vec<K>) -> &mut RedisCommand

Source§

fn expire<K: ToString>(&mut self, key: K, expiry: i64) -> &mut RedisCommand

Source§

fn expireat<K: ToString>(&mut self, key: K, timestamp: i64) -> &mut RedisCommand

Source§

fn get<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn getrange<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand

Source§

fn hdel<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand

Source§

fn hmdel<K: ToString, V: ToString>( &mut self, key: K, fields: Vec<V>, ) -> &mut RedisCommand

Source§

fn hexists<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand

Source§

fn hget<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand

Source§

fn hgetall<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn hincrby<K: ToString, F: ToString>( &mut self, key: K, field: F, increment: i64, ) -> &mut RedisCommand

Source§

fn hincrbyfloat<K: ToString, F: ToString>( &mut self, key: K, field: F, increment: f64, ) -> &mut RedisCommand

Source§

fn hkeys<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn hlen<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn hmget<K: ToString, F: ToString>( &mut self, key: K, fields: Vec<F>, ) -> &mut RedisCommand

Source§

fn hmset<K: ToString>( &mut self, key: K, fields: HashMap<String, K>, ) -> &mut RedisCommand

Source§

fn hset<K: ToString, F: ToString, V: ToString>( &mut self, key: K, field: F, value: V, ) -> &mut RedisCommand

Source§

fn hstrlen<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand

Source§

fn hsetnx<K: ToString, F: ToString, V: ToString>( &mut self, key: K, field: F, value: V, ) -> &mut RedisCommand

Source§

fn hvals<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn lindex<K: ToString>(&mut self, key: K, index: i32) -> &mut RedisCommand

Source§

fn linsert_after<K: ToString, P: ToString, V: ToString>( &mut self, key: K, pivot: P, value: V, ) -> &mut RedisCommand

Source§

fn linsert_before<K: ToString, P: ToString, V: ToString>( &mut self, key: K, pivot: P, value: V, ) -> &mut RedisCommand

Source§

fn llen<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn lpop<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn lpush<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn mlpush<K: ToString, V: ToString>( &mut self, key: K, values: Vec<V>, ) -> &mut RedisCommand

Source§

fn lpushx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn lrange<K: ToString>( &mut self, key: K, start: i32, end: i32, ) -> &mut RedisCommand

Source§

fn lrem<K: ToString, V: ToString>( &mut self, key: K, count: i32, value: V, ) -> &mut RedisCommand

Source§

fn lset<K: ToString, V: ToString>( &mut self, key: K, index: i32, value: V, ) -> &mut RedisCommand

Source§

fn ltrim<K: ToString>( &mut self, key: K, start: i32, end: i32, ) -> &mut RedisCommand

Source§

fn multi(&mut self) -> &mut RedisCommand

Source§

fn rename<K: ToString, N: ToString>( &mut self, key: K, new_key: N, ) -> &mut RedisCommand

Source§

fn renamenx<K: ToString, N: ToString>( &mut self, key: K, new_key: N, ) -> &mut RedisCommand

Source§

fn rpop<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn rpoplpush<S: ToString, D: ToString>( &mut self, source: S, dest: D, ) -> &mut RedisCommand

Source§

fn rpush<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn mrpush<K: ToString, V: ToString>( &mut self, key: K, values: Vec<V>, ) -> &mut RedisCommand

Source§

fn rpushx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn sadd<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand

Source§

fn msadd<K: ToString, M: ToString>( &mut self, key: K, members: Vec<M>, ) -> &mut RedisCommand

Source§

fn sadd_binary<K: ToString>( &mut self, key: K, member: &[u8], ) -> &mut RedisCommand

Source§

fn scard<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn select(&mut self, db_index: i32) -> &mut RedisCommand

Source§

fn set<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn set_binary<K: ToString>(&mut self, key: K, value: &[u8]) -> &mut RedisCommand

Source§

fn setex<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand

Source§

fn psetex<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand

Source§

fn setnx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn setxx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand

Source§

fn setex_nx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand

Source§

fn setex_xx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand

Source§

fn psetex_nx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand

Source§

fn psetex_xx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand

Source§

fn setbit<K: ToString>( &mut self, key: K, offset: u32, bit: u8, ) -> &mut RedisCommand

Source§

fn setrange<K: ToString, V: ToString>( &mut self, key: K, offset: u32, value: V, ) -> &mut RedisCommand

Source§

fn sismember<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand

Source§

fn smembers<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn spop<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn spop_count<K: ToString>(&mut self, key: K, count: u32) -> &mut RedisCommand

Source§

fn srem<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand

Source§

fn msrem<K: ToString, M: ToString>( &mut self, key: K, members: Vec<M>, ) -> &mut RedisCommand

Source§

fn strlen<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn ttl<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn unwatch(&mut self) -> &mut RedisCommand

Source§

fn watch<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn mwatch<K: ToString>(&mut self, keys: Vec<K>) -> &mut RedisCommand

Source§

fn zadd<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand

Source§

fn zadd_binary<K: ToString>( &mut self, key: K, score: f64, member: &[u8], ) -> &mut RedisCommand

Source§

fn zaddnx<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand

Source§

fn zaddxx<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand

Source§

fn zaddnx_ch<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand

Source§

fn zaddxx_ch<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand

Source§

fn zcard<K: ToString>(&mut self, key: K) -> &mut RedisCommand

Source§

fn zcount<K: ToString, S: ToString, E: ToString>( &mut self, key: K, start_range: S, end_range: E, ) -> &mut RedisCommand

Source§

fn zincrby<K: ToString, V: ToString>( &mut self, key: K, increment: f64, member: V, ) -> &mut RedisCommand

Source§

fn zlexcount<K: ToString, S: ToString, E: ToString>( &mut self, key: K, min: S, max: E, ) -> &mut RedisCommand

Source§

fn zrem<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand

Source§

fn mzrem<K: ToString, M: ToString>( &mut self, key: K, members: Vec<M>, ) -> &mut RedisCommand

Source§

fn zrange<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand

Source§

fn zrange_with_scores<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand

Source§

fn zrevrange<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand

Source§

fn zrevrange_with_scores<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand

Source§

impl<'a> From<&'a mut RedisCommand> for &'a [u8]

Source§

fn from(command: &mut RedisCommand) -> &[u8]

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut RedisCommand> for Vec<u8>

Source§

fn from(command: &mut RedisCommand) -> Vec<u8>

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.