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
impl RedisCommand
pub fn new() -> RedisCommand
Sourcepub fn add_cmd<C>(&mut self, command: C) -> &mut RedisCommandwhere
C: ToString,
pub fn add_cmd<C>(&mut self, command: C) -> &mut RedisCommandwhere
C: ToString,
Add a string representing the command (APPEND, GET, SET…) to the command. (Each command should start with this method)
Sourcepub fn add_arg<A>(&mut self, arg: A) -> &mut RedisCommandwhere
A: ToString,
pub fn add_arg<A>(&mut self, arg: A) -> &mut RedisCommandwhere
A: ToString,
Add a whitespace and a string to the commands
Sourcepub fn add_args<A>(&mut self, args: Vec<A>) -> &mut RedisCommandwhere
A: ToString,
pub fn add_args<A>(&mut self, args: Vec<A>) -> &mut RedisCommandwhere
A: ToString,
Add a whitespace and a string for each one of the vector’s items to the commands
Sourcepub fn add_arg_map<F: ToString>(
&mut self,
args: HashMap<String, F>,
) -> &mut RedisCommand
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
Sourcepub fn add_binary_arg(&mut self, arg: &[u8]) -> &mut RedisCommand
pub fn add_binary_arg(&mut self, arg: &[u8]) -> &mut RedisCommand
Add a whitespace and then an array of byte to the command
Sourcepub fn end(&mut self) -> &mut RedisCommand
pub fn end(&mut self) -> &mut RedisCommand
Teminate a command
Sourcepub fn get_command_nb(&self) -> usize
pub fn get_command_nb(&self) -> usize
Get the number of commands in the RedisCommand object
Trait Implementations§
Source§impl CommandBuilder for RedisCommand
impl CommandBuilder for RedisCommand
fn append<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn auth<P: ToString>(&mut self, password: P) -> &mut RedisCommand
fn bgrewriteaof(&mut self) -> &mut RedisCommand
fn bgsave(&mut self) -> &mut RedisCommand
fn bitcount<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn bitcount_range<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand
fn blpop<K: ToString>(&mut self, key: K, timeout: u32) -> &mut RedisCommand
fn mblpop<K: ToString>( &mut self, keys: Vec<K>, timeout: u32, ) -> &mut RedisCommand
fn brpop<K: ToString>(&mut self, key: K, timeout: u32) -> &mut RedisCommand
fn mbrpop<K: ToString>( &mut self, keys: Vec<K>, timeout: u32, ) -> &mut RedisCommand
fn brpoplpush<S: ToString, D: ToString>( &mut self, source: S, dest: D, timeout: u32, ) -> &mut RedisCommand
fn decr<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn decrby<K: ToString>(&mut self, key: K, increment: i64) -> &mut RedisCommand
fn del<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn mdel<K: ToString>(&mut self, keys: Vec<K>) -> &mut RedisCommand
fn discard(&mut self) -> &mut RedisCommand
fn echo<K: ToString>(&mut self, msg: K) -> &mut RedisCommand
fn exec(&mut self) -> &mut RedisCommand
fn exists<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn mexists<K: ToString>(&mut self, keys: Vec<K>) -> &mut RedisCommand
fn expire<K: ToString>(&mut self, key: K, expiry: i64) -> &mut RedisCommand
fn expireat<K: ToString>(&mut self, key: K, timestamp: i64) -> &mut RedisCommand
fn get<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn getrange<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand
fn hdel<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand
fn hmdel<K: ToString, V: ToString>( &mut self, key: K, fields: Vec<V>, ) -> &mut RedisCommand
fn hexists<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand
fn hget<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand
fn hgetall<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn hincrby<K: ToString, F: ToString>( &mut self, key: K, field: F, increment: i64, ) -> &mut RedisCommand
fn hincrbyfloat<K: ToString, F: ToString>( &mut self, key: K, field: F, increment: f64, ) -> &mut RedisCommand
fn hkeys<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn hlen<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn hmget<K: ToString, F: ToString>( &mut self, key: K, fields: Vec<F>, ) -> &mut RedisCommand
fn hmset<K: ToString>( &mut self, key: K, fields: HashMap<String, K>, ) -> &mut RedisCommand
fn hset<K: ToString, F: ToString, V: ToString>( &mut self, key: K, field: F, value: V, ) -> &mut RedisCommand
fn hstrlen<K: ToString, F: ToString>( &mut self, key: K, field: F, ) -> &mut RedisCommand
fn hsetnx<K: ToString, F: ToString, V: ToString>( &mut self, key: K, field: F, value: V, ) -> &mut RedisCommand
fn hvals<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn lindex<K: ToString>(&mut self, key: K, index: i32) -> &mut RedisCommand
fn linsert_after<K: ToString, P: ToString, V: ToString>( &mut self, key: K, pivot: P, value: V, ) -> &mut RedisCommand
fn linsert_before<K: ToString, P: ToString, V: ToString>( &mut self, key: K, pivot: P, value: V, ) -> &mut RedisCommand
fn llen<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn lpop<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn lpush<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn mlpush<K: ToString, V: ToString>( &mut self, key: K, values: Vec<V>, ) -> &mut RedisCommand
fn lpushx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn lrange<K: ToString>( &mut self, key: K, start: i32, end: i32, ) -> &mut RedisCommand
fn lrem<K: ToString, V: ToString>( &mut self, key: K, count: i32, value: V, ) -> &mut RedisCommand
fn lset<K: ToString, V: ToString>( &mut self, key: K, index: i32, value: V, ) -> &mut RedisCommand
fn ltrim<K: ToString>( &mut self, key: K, start: i32, end: i32, ) -> &mut RedisCommand
fn multi(&mut self) -> &mut RedisCommand
fn rename<K: ToString, N: ToString>( &mut self, key: K, new_key: N, ) -> &mut RedisCommand
fn renamenx<K: ToString, N: ToString>( &mut self, key: K, new_key: N, ) -> &mut RedisCommand
fn rpop<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn rpoplpush<S: ToString, D: ToString>( &mut self, source: S, dest: D, ) -> &mut RedisCommand
fn rpush<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn mrpush<K: ToString, V: ToString>( &mut self, key: K, values: Vec<V>, ) -> &mut RedisCommand
fn rpushx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn sadd<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand
fn msadd<K: ToString, M: ToString>( &mut self, key: K, members: Vec<M>, ) -> &mut RedisCommand
fn sadd_binary<K: ToString>( &mut self, key: K, member: &[u8], ) -> &mut RedisCommand
fn scard<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn select(&mut self, db_index: i32) -> &mut RedisCommand
fn set<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn set_binary<K: ToString>(&mut self, key: K, value: &[u8]) -> &mut RedisCommand
fn setex<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand
fn psetex<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand
fn setnx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn setxx<K: ToString, V: ToString>( &mut self, key: K, value: V, ) -> &mut RedisCommand
fn setex_nx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand
fn setex_xx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand
fn psetex_nx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand
fn psetex_xx<K: ToString, V: ToString>( &mut self, key: K, value: V, expiry: i64, ) -> &mut RedisCommand
fn setbit<K: ToString>( &mut self, key: K, offset: u32, bit: u8, ) -> &mut RedisCommand
fn setrange<K: ToString, V: ToString>( &mut self, key: K, offset: u32, value: V, ) -> &mut RedisCommand
fn sismember<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand
fn smembers<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn spop<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn spop_count<K: ToString>(&mut self, key: K, count: u32) -> &mut RedisCommand
fn srem<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand
fn msrem<K: ToString, M: ToString>( &mut self, key: K, members: Vec<M>, ) -> &mut RedisCommand
fn strlen<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn ttl<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn unwatch(&mut self) -> &mut RedisCommand
fn watch<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn mwatch<K: ToString>(&mut self, keys: Vec<K>) -> &mut RedisCommand
fn zadd<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand
fn zadd_binary<K: ToString>( &mut self, key: K, score: f64, member: &[u8], ) -> &mut RedisCommand
fn zaddnx<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand
fn zaddxx<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand
fn zaddnx_ch<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand
fn zaddxx_ch<K: ToString, V: ToString>( &mut self, key: K, score: f64, member: V, ) -> &mut RedisCommand
fn zcard<K: ToString>(&mut self, key: K) -> &mut RedisCommand
fn zcount<K: ToString, S: ToString, E: ToString>( &mut self, key: K, start_range: S, end_range: E, ) -> &mut RedisCommand
fn zincrby<K: ToString, V: ToString>( &mut self, key: K, increment: f64, member: V, ) -> &mut RedisCommand
fn zlexcount<K: ToString, S: ToString, E: ToString>( &mut self, key: K, min: S, max: E, ) -> &mut RedisCommand
fn zrem<K: ToString, M: ToString>( &mut self, key: K, member: M, ) -> &mut RedisCommand
fn mzrem<K: ToString, M: ToString>( &mut self, key: K, members: Vec<M>, ) -> &mut RedisCommand
fn zrange<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand
fn zrange_with_scores<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand
fn zrevrange<K: ToString>( &mut self, key: K, start_range: i64, end_range: i64, ) -> &mut RedisCommand
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]
impl<'a> From<&'a mut RedisCommand> for &'a [u8]
Auto Trait Implementations§
impl Freeze for RedisCommand
impl RefUnwindSafe for RedisCommand
impl Send for RedisCommand
impl Sync for RedisCommand
impl Unpin for RedisCommand
impl UnsafeUnpin for RedisCommand
impl UnwindSafe for RedisCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more