pub struct Pipeline { /* private fields */ }
Expand description

Represents a redis command pipeline.

Implementations§

§

impl Pipeline

A pipeline allows you to send multiple commands in one go to the redis server. API wise it’s very similar to just using a command but it allows multiple commands to be chained and some features such as iteration are not available.

Basic example:

let ((k1, k2),) : ((i32, i32),) = redis::pipe()
    .cmd("SET").arg("key_1").arg(42).ignore()
    .cmd("SET").arg("key_2").arg(43).ignore()
    .cmd("MGET").arg(&["key_1", "key_2"]).query(&mut con).unwrap();

As you can see with cmd you can start a new command. By default each command produces a value but for some you can ignore them by calling ignore on the command. That way it will be skipped in the return value which is useful for SET commands and others, which do not have a useful return value.

pub fn new() -> Pipeline

Creates an empty pipeline. For consistency with the cmd api a pipe function is provided as alias.

pub fn with_capacity(capacity: usize) -> Pipeline

Creates an empty pipeline with pre-allocated capacity.

pub fn atomic(&mut self) -> &mut Pipeline

This enables atomic mode. In atomic mode the whole pipeline is enclosed in MULTI/EXEC. From the user’s point of view nothing changes however. This is easier than using MULTI/EXEC yourself as the format does not change.

let (k1, k2) : (i32, i32) = redis::pipe()
    .atomic()
    .cmd("GET").arg("key_1")
    .cmd("GET").arg("key_2").query(&mut con).unwrap();

pub fn get_packed_pipeline(&self) -> Vec<u8>

Returns the encoded pipeline commands.

pub fn query<T>(&self, con: &mut dyn ConnectionLike) -> Result<T, RedisError>
where T: FromRedisValue,

Executes the pipeline and fetches the return values. Since most pipelines return different types it’s recommended to use tuple matching to process the results:

let (k1, k2) : (i32, i32) = redis::pipe()
    .cmd("SET").arg("key_1").arg(42).ignore()
    .cmd("SET").arg("key_2").arg(43).ignore()
    .cmd("GET").arg("key_1")
    .cmd("GET").arg("key_2").query(&mut con).unwrap();

NOTE: A Pipeline object may be reused after query() with all the commands as were inserted to them. In order to clear a Pipeline object with minimal memory released/allocated, it is necessary to call the clear() before inserting new commands.

pub async fn query_async<C, T>(&self, con: &mut C) -> Result<T, RedisError>

Async version of query.

pub fn execute(&self, con: &mut dyn ConnectionLike)

This is a shortcut to query() that does not return a value and will fail the task if the query of the pipeline fails.

This is equivalent to a call of query like this:

let _ : () = redis::pipe().cmd("PING").query(&mut con).unwrap();

NOTE: A Pipeline object may be reused after query() with all the commands as were inserted to them. In order to clear a Pipeline object with minimal memory released/allocated, it is necessary to call the clear() before inserting new commands.

§

impl Pipeline

pub fn add_command(&mut self, cmd: Cmd) -> &mut Pipeline

Adds a command to the cluster pipeline.

pub fn cmd(&mut self, name: &str) -> &mut Pipeline

Starts a new command. Functions such as arg then become available to add more arguments to that command.

pub fn cmd_iter(&self) -> impl Iterator<Item = &Cmd>

Returns an iterator over all the commands currently in this pipeline

pub fn ignore(&mut self) -> &mut Pipeline

Instructs the pipeline to ignore the return value of this command. It will still be ensured that it is not an error, but any successful result is just thrown away. This makes result processing through tuples much easier because you do not need to handle all the items you do not care about.

pub fn arg<T>(&mut self, arg: T) -> &mut Pipeline
where T: ToRedisArgs,

Adds an argument to the last started command. This works similar to the arg method of the Cmd object.

Note that this function fails the task if executed on an empty pipeline.

pub fn clear(&mut self)

Clear a pipeline object’s internal data structure.

This allows reusing a pipeline object as a clear object while performing a minimal amount of memory released/reallocated.

§

impl Pipeline

Implements common redis commands for pipelines. Unlike the regular commands trait, this returns the pipeline rather than a result directly. Other than that it works the same however.

pub fn get<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the value of a key. If key is a vec this becomes an MGET.

pub fn mget<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get values of keys

pub fn keys<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Gets all keys matching pattern

pub fn set<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Set the string value of a key.

pub fn set_options<K, V, 'a>( &mut self, key: K, value: V, options: SetOptions ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Set the string value of a key with options.

pub fn set_multiple<K, V, 'a>(&mut self, items: &'a [(K, V)]) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

👎Deprecated since 0.22.4: Renamed to mset() to reflect Redis name

Sets multiple keys to their values.

pub fn mset<K, V, 'a>(&mut self, items: &'a [(K, V)]) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Sets multiple keys to their values.

pub fn set_ex<K, V, 'a>( &mut self, key: K, value: V, seconds: usize ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Set the value and expiration of a key.

pub fn pset_ex<K, V, 'a>( &mut self, key: K, value: V, milliseconds: usize ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Set the value and expiration in milliseconds of a key.

pub fn set_nx<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Set the value of a key, only if the key does not exist

pub fn mset_nx<K, V, 'a>(&mut self, items: &'a [(K, V)]) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Sets multiple keys to their values failing if at least one already exists.

pub fn getset<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Set the string value of a key and return its old value.

pub fn getrange<K, 'a>( &mut self, key: K, from: isize, to: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Get a range of bytes/substring from the value of a key. Negative values provide an offset from the end of the value.

pub fn setrange<K, V, 'a>( &mut self, key: K, offset: isize, value: V ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Overwrite the part of the value stored in key at the specified offset.

pub fn del<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Delete one or more keys.

pub fn exists<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Determine if a key exists.

pub fn key_type<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Determine the type of a key.

pub fn expire<K, 'a>(&mut self, key: K, seconds: usize) -> &mut Pipeline
where K: ToRedisArgs,

Set a key’s time to live in seconds.

pub fn expire_at<K, 'a>(&mut self, key: K, ts: usize) -> &mut Pipeline
where K: ToRedisArgs,

Set the expiration for a key as a UNIX timestamp.

pub fn pexpire<K, 'a>(&mut self, key: K, ms: usize) -> &mut Pipeline
where K: ToRedisArgs,

Set a key’s time to live in milliseconds.

pub fn pexpire_at<K, 'a>(&mut self, key: K, ts: usize) -> &mut Pipeline
where K: ToRedisArgs,

Set the expiration for a key as a UNIX timestamp in milliseconds.

pub fn persist<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Remove the expiration from a key.

pub fn ttl<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the expiration time of a key.

pub fn pttl<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the expiration time of a key in milliseconds.

pub fn get_ex<K, 'a>(&mut self, key: K, expire_at: Expiry) -> &mut Pipeline
where K: ToRedisArgs,

Get the value of a key and set expiration

pub fn get_del<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the value of a key and delete it

pub fn rename<K, N, 'a>(&mut self, key: K, new_key: N) -> &mut Pipeline
where K: ToRedisArgs, N: ToRedisArgs,

Rename a key.

pub fn rename_nx<K, N, 'a>(&mut self, key: K, new_key: N) -> &mut Pipeline
where K: ToRedisArgs, N: ToRedisArgs,

Rename a key, only if the new key does not exist.

Unlink one or more keys.

pub fn append<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Append a value to a key.

pub fn incr<K, V, 'a>(&mut self, key: K, delta: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Increment the numeric value of a key by the given amount. This issues a INCRBY or INCRBYFLOAT depending on the type.

pub fn decr<K, V, 'a>(&mut self, key: K, delta: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Decrement the numeric value of a key by the given amount.

pub fn setbit<K, 'a>( &mut self, key: K, offset: usize, value: bool ) -> &mut Pipeline
where K: ToRedisArgs,

Sets or clears the bit at offset in the string value stored at key.

pub fn getbit<K, 'a>(&mut self, key: K, offset: usize) -> &mut Pipeline
where K: ToRedisArgs,

Returns the bit value at offset in the string value stored at key.

pub fn bitcount<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Count set bits in a string.

pub fn bitcount_range<K, 'a>( &mut self, key: K, start: usize, end: usize ) -> &mut Pipeline
where K: ToRedisArgs,

Count set bits in a string in a range.

pub fn bit_and<D, S, 'a>(&mut self, dstkey: D, srckeys: S) -> &mut Pipeline
where D: ToRedisArgs, S: ToRedisArgs,

Perform a bitwise AND between multiple keys (containing string values) and store the result in the destination key.

pub fn bit_or<D, S, 'a>(&mut self, dstkey: D, srckeys: S) -> &mut Pipeline
where D: ToRedisArgs, S: ToRedisArgs,

Perform a bitwise OR between multiple keys (containing string values) and store the result in the destination key.

pub fn bit_xor<D, S, 'a>(&mut self, dstkey: D, srckeys: S) -> &mut Pipeline
where D: ToRedisArgs, S: ToRedisArgs,

Perform a bitwise XOR between multiple keys (containing string values) and store the result in the destination key.

pub fn bit_not<D, S, 'a>(&mut self, dstkey: D, srckey: S) -> &mut Pipeline
where D: ToRedisArgs, S: ToRedisArgs,

Perform a bitwise NOT of the key (containing string values) and store the result in the destination key.

pub fn strlen<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the length of the value stored in a key.

pub fn hget<K, F, 'a>(&mut self, key: K, field: F) -> &mut Pipeline
where K: ToRedisArgs, F: ToRedisArgs,

Gets a single (or multiple) fields from a hash.

pub fn hdel<K, F, 'a>(&mut self, key: K, field: F) -> &mut Pipeline
where K: ToRedisArgs, F: ToRedisArgs,

Deletes a single (or multiple) fields from a hash.

pub fn hset<K, F, V, 'a>(&mut self, key: K, field: F, value: V) -> &mut Pipeline

Sets a single field in a hash.

pub fn hset_nx<K, F, V, 'a>( &mut self, key: K, field: F, value: V ) -> &mut Pipeline

Sets a single field in a hash if it does not exist.

pub fn hset_multiple<K, F, V, 'a>( &mut self, key: K, items: &'a [(F, V)] ) -> &mut Pipeline

Sets a multiple fields in a hash.

pub fn hincr<K, F, D, 'a>( &mut self, key: K, field: F, delta: D ) -> &mut Pipeline

Increments a value.

pub fn hexists<K, F, 'a>(&mut self, key: K, field: F) -> &mut Pipeline
where K: ToRedisArgs, F: ToRedisArgs,

Checks if a field in a hash exists.

pub fn hkeys<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Gets all the keys in a hash.

pub fn hvals<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Gets all the values in a hash.

pub fn hgetall<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Gets all the fields and values in a hash.

pub fn hlen<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Gets the length of a hash.

pub fn blmove<S, D, 'a>( &mut self, srckey: S, dstkey: D, src_dir: Direction, dst_dir: Direction, timeout: usize ) -> &mut Pipeline
where S: ToRedisArgs, D: ToRedisArgs,

Pop an element from a list, push it to another list and return it; or block until one is available

pub fn blmpop<K, 'a>( &mut self, timeout: usize, numkeys: usize, key: K, dir: Direction, count: usize ) -> &mut Pipeline
where K: ToRedisArgs,

Pops count elements from the first non-empty list key from the list of provided key names; or blocks until one is available.

pub fn blpop<K, 'a>(&mut self, key: K, timeout: usize) -> &mut Pipeline
where K: ToRedisArgs,

Remove and get the first element in a list, or block until one is available.

pub fn brpop<K, 'a>(&mut self, key: K, timeout: usize) -> &mut Pipeline
where K: ToRedisArgs,

Remove and get the last element in a list, or block until one is available.

pub fn brpoplpush<S, D, 'a>( &mut self, srckey: S, dstkey: D, timeout: usize ) -> &mut Pipeline
where S: ToRedisArgs, D: ToRedisArgs,

Pop a value from a list, push it to another list and return it; or block until one is available.

pub fn lindex<K, 'a>(&mut self, key: K, index: isize) -> &mut Pipeline
where K: ToRedisArgs,

Get an element from a list by its index.

pub fn linsert_before<K, P, V, 'a>( &mut self, key: K, pivot: P, value: V ) -> &mut Pipeline

Insert an element before another element in a list.

pub fn linsert_after<K, P, V, 'a>( &mut self, key: K, pivot: P, value: V ) -> &mut Pipeline

Insert an element after another element in a list.

pub fn llen<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Returns the length of the list stored at key.

pub fn lmove<S, D, 'a>( &mut self, srckey: S, dstkey: D, src_dir: Direction, dst_dir: Direction ) -> &mut Pipeline
where S: ToRedisArgs, D: ToRedisArgs,

Pop an element a list, push it to another list and return it

pub fn lmpop<K, 'a>( &mut self, numkeys: usize, key: K, dir: Direction, count: usize ) -> &mut Pipeline
where K: ToRedisArgs,

Pops count elements from the first non-empty list key from the list of provided key names.

pub fn lpop<K, 'a>( &mut self, key: K, count: Option<NonZeroUsize> ) -> &mut Pipeline
where K: ToRedisArgs,

Removes and returns the up to count first elements of the list stored at key.

If count is not specified, then defaults to first element.

pub fn lpos<K, V, 'a>( &mut self, key: K, value: V, options: LposOptions ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Returns the index of the first matching value of the list stored at key.

pub fn lpush<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Insert all the specified values at the head of the list stored at key.

pub fn lpush_exists<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Inserts a value at the head of the list stored at key, only if key already exists and holds a list.

pub fn lrange<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Returns the specified elements of the list stored at key.

pub fn lrem<K, V, 'a>( &mut self, key: K, count: isize, value: V ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Removes the first count occurrences of elements equal to value from the list stored at key.

pub fn ltrim<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Trim an existing list so that it will contain only the specified range of elements specified.

pub fn lset<K, V, 'a>( &mut self, key: K, index: isize, value: V ) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Sets the list element at index to value

pub fn rpop<K, 'a>( &mut self, key: K, count: Option<NonZeroUsize> ) -> &mut Pipeline
where K: ToRedisArgs,

Removes and returns the up to count last elements of the list stored at key

If count is not specified, then defaults to last element.

pub fn rpoplpush<K, D, 'a>(&mut self, key: K, dstkey: D) -> &mut Pipeline
where K: ToRedisArgs, D: ToRedisArgs,

Pop a value from a list, push it to another list and return it.

pub fn rpush<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Insert all the specified values at the tail of the list stored at key.

pub fn rpush_exists<K, V, 'a>(&mut self, key: K, value: V) -> &mut Pipeline
where K: ToRedisArgs, V: ToRedisArgs,

Inserts value at the tail of the list stored at key, only if key already exists and holds a list.

pub fn sadd<K, M, 'a>(&mut self, key: K, member: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Add one or more members to a set.

pub fn scard<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the number of members in a set.

pub fn sdiff<K, 'a>(&mut self, keys: K) -> &mut Pipeline
where K: ToRedisArgs,

Subtract multiple sets.

pub fn sdiffstore<D, K, 'a>(&mut self, dstkey: D, keys: K) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Subtract multiple sets and store the resulting set in a key.

pub fn sinter<K, 'a>(&mut self, keys: K) -> &mut Pipeline
where K: ToRedisArgs,

Intersect multiple sets.

pub fn sinterstore<D, K, 'a>(&mut self, dstkey: D, keys: K) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Intersect multiple sets and store the resulting set in a key.

pub fn sismember<K, M, 'a>(&mut self, key: K, member: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Determine if a given value is a member of a set.

pub fn smembers<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get all the members in a set.

pub fn smove<S, D, M, 'a>( &mut self, srckey: S, dstkey: D, member: M ) -> &mut Pipeline

Move a member from one set to another.

pub fn spop<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Remove and return a random member from a set.

pub fn srandmember<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get one random member from a set.

pub fn srandmember_multiple<K, 'a>( &mut self, key: K, count: usize ) -> &mut Pipeline
where K: ToRedisArgs,

Get multiple random members from a set.

pub fn srem<K, M, 'a>(&mut self, key: K, member: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Remove one or more members from a set.

pub fn sunion<K, 'a>(&mut self, keys: K) -> &mut Pipeline
where K: ToRedisArgs,

Add multiple sets.

pub fn sunionstore<D, K, 'a>(&mut self, dstkey: D, keys: K) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Add multiple sets and store the resulting set in a key.

pub fn zadd<K, S, M, 'a>( &mut self, key: K, member: M, score: S ) -> &mut Pipeline

Add one member to a sorted set, or update its score if it already exists.

pub fn zadd_multiple<K, S, M, 'a>( &mut self, key: K, items: &'a [(S, M)] ) -> &mut Pipeline

Add multiple members to a sorted set, or update its score if it already exists.

pub fn zcard<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Get the number of members in a sorted set.

pub fn zcount<K, M, MM, 'a>(&mut self, key: K, min: M, max: MM) -> &mut Pipeline

Count the members in a sorted set with scores within the given values.

pub fn zincr<K, M, D, 'a>( &mut self, key: K, member: M, delta: D ) -> &mut Pipeline

Increments the member in a sorted set at key by delta. If the member does not exist, it is added with delta as its score.

pub fn zinterstore<D, K, 'a>( &mut self, dstkey: D, keys: &'a [K] ) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Intersect multiple sorted sets and store the resulting sorted set in a new key using SUM as aggregation function.

pub fn zinterstore_min<D, K, 'a>( &mut self, dstkey: D, keys: &'a [K] ) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Intersect multiple sorted sets and store the resulting sorted set in a new key using MIN as aggregation function.

pub fn zinterstore_max<D, K, 'a>( &mut self, dstkey: D, keys: &'a [K] ) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Intersect multiple sorted sets and store the resulting sorted set in a new key using MAX as aggregation function.

pub fn zinterstore_weights<D, K, W, 'a>( &mut self, dstkey: D, keys: &'a [(K, W)] ) -> &mut Pipeline

Commands::zinterstore, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.

pub fn zinterstore_min_weights<D, K, W, 'a>( &mut self, dstkey: D, keys: &'a [(K, W)] ) -> &mut Pipeline

Commands::zinterstore_min, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.

pub fn zinterstore_max_weights<D, K, W, 'a>( &mut self, dstkey: D, keys: &'a [(K, W)] ) -> &mut Pipeline

Commands::zinterstore_max, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.

pub fn zlexcount<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM ) -> &mut Pipeline

Count the number of members in a sorted set between a given lexicographical range.

pub fn zpopmax<K, 'a>(&mut self, key: K, count: isize) -> &mut Pipeline
where K: ToRedisArgs,

Removes and returns up to count members with the highest scores in a sorted set

pub fn zpopmin<K, 'a>(&mut self, key: K, count: isize) -> &mut Pipeline
where K: ToRedisArgs,

Removes and returns up to count members with the lowest scores in a sorted set

pub fn zmpop_max<K, 'a>(&mut self, keys: &'a [K], count: isize) -> &mut Pipeline
where K: ToRedisArgs,

Removes and returns up to count members with the highest scores, from the first non-empty sorted set in the provided list of key names.

pub fn zmpop_min<K, 'a>(&mut self, keys: &'a [K], count: isize) -> &mut Pipeline
where K: ToRedisArgs,

Removes and returns up to count members with the lowest scores, from the first non-empty sorted set in the provided list of key names.

pub fn zrandmember<K, 'a>( &mut self, key: K, count: Option<isize> ) -> &mut Pipeline
where K: ToRedisArgs,

Return up to count random members in a sorted set (or 1 if count == None)

pub fn zrandmember_withscores<K, 'a>( &mut self, key: K, count: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Return up to count random members in a sorted set with scores

pub fn zrange<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Return a range of members in a sorted set, by index

pub fn zrange_withscores<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Return a range of members in a sorted set, by index with scores.

pub fn zrangebylex<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM ) -> &mut Pipeline

Return a range of members in a sorted set, by lexicographical range.

pub fn zrangebylex_limit<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM, offset: isize, count: isize ) -> &mut Pipeline

Return a range of members in a sorted set, by lexicographical range with offset and limit.

pub fn zrevrangebylex<K, MM, M, 'a>( &mut self, key: K, max: MM, min: M ) -> &mut Pipeline

Return a range of members in a sorted set, by lexicographical range.

pub fn zrevrangebylex_limit<K, MM, M, 'a>( &mut self, key: K, max: MM, min: M, offset: isize, count: isize ) -> &mut Pipeline

Return a range of members in a sorted set, by lexicographical range with offset and limit.

pub fn zrangebyscore<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM ) -> &mut Pipeline

Return a range of members in a sorted set, by score.

pub fn zrangebyscore_withscores<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM ) -> &mut Pipeline

Return a range of members in a sorted set, by score with scores.

pub fn zrangebyscore_limit<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM, offset: isize, count: isize ) -> &mut Pipeline

Return a range of members in a sorted set, by score with limit.

pub fn zrangebyscore_limit_withscores<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM, offset: isize, count: isize ) -> &mut Pipeline

Return a range of members in a sorted set, by score with limit with scores.

pub fn zrank<K, M, 'a>(&mut self, key: K, member: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Determine the index of a member in a sorted set.

pub fn zrem<K, M, 'a>(&mut self, key: K, members: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Remove one or more members from a sorted set.

pub fn zrembylex<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM ) -> &mut Pipeline

Remove all members in a sorted set between the given lexicographical range.

pub fn zremrangebyrank<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Remove all members in a sorted set within the given indexes.

pub fn zrembyscore<K, M, MM, 'a>( &mut self, key: K, min: M, max: MM ) -> &mut Pipeline

Remove all members in a sorted set within the given scores.

pub fn zrevrange<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Return a range of members in a sorted set, by index, with scores ordered from high to low.

pub fn zrevrange_withscores<K, 'a>( &mut self, key: K, start: isize, stop: isize ) -> &mut Pipeline
where K: ToRedisArgs,

Return a range of members in a sorted set, by index, with scores ordered from high to low.

pub fn zrevrangebyscore<K, MM, M, 'a>( &mut self, key: K, max: MM, min: M ) -> &mut Pipeline

Return a range of members in a sorted set, by score.

pub fn zrevrangebyscore_withscores<K, MM, M, 'a>( &mut self, key: K, max: MM, min: M ) -> &mut Pipeline

Return a range of members in a sorted set, by score with scores.

pub fn zrevrangebyscore_limit<K, MM, M, 'a>( &mut self, key: K, max: MM, min: M, offset: isize, count: isize ) -> &mut Pipeline

Return a range of members in a sorted set, by score with limit.

pub fn zrevrangebyscore_limit_withscores<K, MM, M, 'a>( &mut self, key: K, max: MM, min: M, offset: isize, count: isize ) -> &mut Pipeline

Return a range of members in a sorted set, by score with limit with scores.

pub fn zrevrank<K, M, 'a>(&mut self, key: K, member: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Determine the index of a member in a sorted set, with scores ordered from high to low.

pub fn zscore<K, M, 'a>(&mut self, key: K, member: M) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Get the score associated with the given member in a sorted set.

pub fn zscore_multiple<K, M, 'a>( &mut self, key: K, members: &'a [M] ) -> &mut Pipeline
where K: ToRedisArgs, M: ToRedisArgs,

Get the scores associated with multiple members in a sorted set.

pub fn zunionstore<D, K, 'a>( &mut self, dstkey: D, keys: &'a [K] ) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Unions multiple sorted sets and store the resulting sorted set in a new key using SUM as aggregation function.

pub fn zunionstore_min<D, K, 'a>( &mut self, dstkey: D, keys: &'a [K] ) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Unions multiple sorted sets and store the resulting sorted set in a new key using MIN as aggregation function.

pub fn zunionstore_max<D, K, 'a>( &mut self, dstkey: D, keys: &'a [K] ) -> &mut Pipeline
where D: ToRedisArgs, K: ToRedisArgs,

Unions multiple sorted sets and store the resulting sorted set in a new key using MAX as aggregation function.

pub fn zunionstore_weights<D, K, W, 'a>( &mut self, dstkey: D, keys: &'a [(K, W)] ) -> &mut Pipeline

Commands::zunionstore, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.

pub fn zunionstore_min_weights<D, K, W, 'a>( &mut self, dstkey: D, keys: &'a [(K, W)] ) -> &mut Pipeline

Commands::zunionstore_min, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.

pub fn zunionstore_max_weights<D, K, W, 'a>( &mut self, dstkey: D, keys: &'a [(K, W)] ) -> &mut Pipeline

Commands::zunionstore_max, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.

pub fn pfadd<K, E, 'a>(&mut self, key: K, element: E) -> &mut Pipeline
where K: ToRedisArgs, E: ToRedisArgs,

Adds the specified elements to the specified HyperLogLog.

pub fn pfcount<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).

pub fn pfmerge<D, S, 'a>(&mut self, dstkey: D, srckeys: S) -> &mut Pipeline
where D: ToRedisArgs, S: ToRedisArgs,

Merge N different HyperLogLogs into a single one.

pub fn publish<K, E, 'a>(&mut self, channel: K, message: E) -> &mut Pipeline
where K: ToRedisArgs, E: ToRedisArgs,

Posts a message to the given channel.

pub fn object_encoding<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Returns the encoding of a key.

pub fn object_idletime<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Returns the time in seconds since the last access of a key.

pub fn object_freq<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Returns the logarithmic access frequency counter of a key.

pub fn object_refcount<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

Returns the reference count of a key.

pub fn xrevrange_all<K, 'a>(&mut self, key: K) -> &mut Pipeline
where K: ToRedisArgs,

This is the reverse version of xrange_all. The same rules apply for start and end here.

XREVRANGE key + -

Trait Implementations§

§

impl Clone for Pipeline

§

fn clone(&self) -> Pipeline

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Default for Pipeline

§

fn default() -> Pipeline

Returns the “default value” for a type. Read more

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoCollection<T> for T

§

fn into_collection<A>(self) -> SmallVec<A>
where A: Array<Item = T>,

Converts self into a collection.
§

fn mapped<U, F, A>(self, f: F) -> SmallVec<A>
where F: FnMut(T) -> U, A: Array<Item = U>,

§

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

§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Primary].

Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color::Fixed].

Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color::Rgb].

Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Black].

Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Red].

Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Green].

Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Yellow].

Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Blue].

Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Magenta].

Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Cyan].

Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color::White].

Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightBlack].

Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightRed].

Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightGreen].

Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightYellow].

Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightBlue].

Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightMagenta].

Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightCyan].

Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightWhite].

Example
println!("{}", value.bright_white());
§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Primary].

Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color::Fixed].

Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color::Rgb].

Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Black].

Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Red].

Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Green].

Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Yellow].

Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Blue].

Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Magenta].

Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Cyan].

Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color::White].

Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightBlack].

Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightRed].

Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightGreen].

Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightYellow].

Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightBlue].

Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightMagenta].

Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightCyan].

Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightWhite].

Example
println!("{}", value.on_bright_white());
§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling [Attribute] value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Bold].

Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Dim].

Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Italic].

Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Underline].

Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute::Blink].

Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute::RapidBlink].

Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Invert].

Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Conceal].

Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Strike].

Example
println!("{}", value.strike());
§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi [Quirk] value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Mask].

Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Wrap].

Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Linger].

Example
println!("{}", value.linger());
§

fn clear(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Clear].

Example
println!("{}", value.clear());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Bright].

Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::OnBright].

Example
println!("{}", value.on_bright());
§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the [Condition] value applies. Replaces any previous condition.

See the crate level docs for more details.

Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more