SetCommands

Trait SetCommands 

Source
pub trait SetCommands<'a>: Sized {
Show 17 methods // Provided methods fn sadd( self, key: impl Serialize, members: impl Serialize, ) -> PreparedCommand<'a, Self, usize> { ... } fn scard(self, key: impl Serialize) -> PreparedCommand<'a, Self, usize> { ... } fn sdiff<R: Response>( self, keys: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn sdiffstore( self, destination: impl Serialize, keys: impl Serialize, ) -> PreparedCommand<'a, Self, usize> { ... } fn sinter<R: Response>( self, keys: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn sintercard( self, keys: impl Serialize, limit: usize, ) -> PreparedCommand<'a, Self, usize> { ... } fn sinterstore( self, destination: impl Serialize, keys: impl Serialize, ) -> PreparedCommand<'a, Self, usize> { ... } fn sismember( self, key: impl Serialize, member: impl Serialize, ) -> PreparedCommand<'a, Self, bool> { ... } fn smembers<R: Response>( self, key: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn smismember<R: Response>( self, key: impl Serialize, members: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn smove( self, source: impl Serialize, destination: impl Serialize, member: impl Serialize, ) -> PreparedCommand<'a, Self, bool> { ... } fn spop<R: Response>( self, key: impl Serialize, count: usize, ) -> PreparedCommand<'a, Self, R> { ... } fn srandmember<R: Response>( self, key: impl Serialize, count: usize, ) -> PreparedCommand<'a, Self, R> { ... } fn srem( self, key: impl Serialize, members: impl Serialize, ) -> PreparedCommand<'a, Self, usize> { ... } fn sscan<R: Response + DeserializeOwned>( self, key: impl Serialize, cursor: u64, options: SScanOptions<'_>, ) -> PreparedCommand<'a, Self, (u64, R)> { ... } fn sunion<R: Response>( self, keys: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn sunionstore( self, destination: impl Serialize, keys: impl Serialize, ) -> PreparedCommand<'a, Self, usize> { ... }
}
Expand description

A group of Redis commands related to Sets

§See Also

Redis Set Commands

Provided Methods§

Source

fn sadd( self, key: impl Serialize, members: impl Serialize, ) -> PreparedCommand<'a, Self, usize>

Add the specified members to the set stored at key.

#Return The number of elements that were added to the set, not including all the elements already present in the set.

§See Also

https://redis.io/commands/sadd/

Source

fn scard(self, key: impl Serialize) -> PreparedCommand<'a, Self, usize>

Returns the set cardinality (number of elements) of the set stored at key.

§Return

The cardinality (number of elements) of the set, or 0 if key does not exist.

§See Also

https://redis.io/commands/scard/

Source

fn sdiff<R: Response>( self, keys: impl Serialize, ) -> PreparedCommand<'a, Self, R>

Returns the members of the set resulting from the difference between the first set and all the successive sets.

§Return

A list with members of the resulting set.

§See Also

https://redis.io/commands/sdiff/

Source

fn sdiffstore( self, destination: impl Serialize, keys: impl Serialize, ) -> PreparedCommand<'a, Self, usize>

This command is equal to sdiff, but instead of returning the resulting set, it is stored in destination.

§Return

The number of elements in the resulting set.

§See Also

https://redis.io/commands/sdiffstore/

Source

fn sinter<R: Response>( self, keys: impl Serialize, ) -> PreparedCommand<'a, Self, R>

Returns the members of the set resulting from the intersection of all the given sets.

§Return

A list with members of the resulting set.

§See Also

https://redis.io/commands/sinter/

Source

fn sintercard( self, keys: impl Serialize, limit: usize, ) -> PreparedCommand<'a, Self, usize>

This command is similar to sinter, but instead of returning the result set, it returns just the cardinality of the result.

limit: if the intersection cardinality reaches limit partway through the computation, the algorithm will exit and yield limit as the cardinality. 0 means unlimited

§Return

A list with members of the resulting set.

§See Also

https://redis.io/commands/sintercard/

Source

fn sinterstore( self, destination: impl Serialize, keys: impl Serialize, ) -> PreparedCommand<'a, Self, usize>

This command is equal to sinter, but instead of returning the resulting set, it is stored in destination.

§Return

The number of elements in the resulting set.

§See Also

https://redis.io/commands/sinterstore/

Source

fn sismember( self, key: impl Serialize, member: impl Serialize, ) -> PreparedCommand<'a, Self, bool>

Returns if member is a member of the set stored at key.

§Return
  • true - if the element is a member of the set.
  • false - if the element is not a member of the set, or if key does not exist.
§See Also

https://redis.io/commands/sismember/

Source

fn smembers<R: Response>( self, key: impl Serialize, ) -> PreparedCommand<'a, Self, R>

Returns all the members of the set value stored at key.

§See Also

https://redis.io/commands/smembers/

Source

fn smismember<R: Response>( self, key: impl Serialize, members: impl Serialize, ) -> PreparedCommand<'a, Self, R>

Returns whether each member is a member of the set stored at key.

§Return

list representing the membership of the given elements, in the same order as they are requested.

§See Also

https://redis.io/commands/smismember/

Source

fn smove( self, source: impl Serialize, destination: impl Serialize, member: impl Serialize, ) -> PreparedCommand<'a, Self, bool>

Move member from the set at source to the set at destination.

§Return
  • true - if the element is moved.
  • false - if the element is not a member of source and no operation was performed.
§See Also

https://redis.io/commands/smove/

Source

fn spop<R: Response>( self, key: impl Serialize, count: usize, ) -> PreparedCommand<'a, Self, R>

Removes and returns one or more random members from the set value store at key.

§Return

the list of popped elements

§See Also

https://redis.io/commands/spop/

Source

fn srandmember<R: Response>( self, key: impl Serialize, count: usize, ) -> PreparedCommand<'a, Self, R>

Removes and returns one or more random members from the set value store at key.

§Return

the list of popped elements

§See Also

https://redis.io/commands/srandmember/

Source

fn srem( self, key: impl Serialize, members: impl Serialize, ) -> PreparedCommand<'a, Self, usize>

Remove the specified members from the set stored at key.

§Return

the number of members that were removed from the set, not including non existing members.

§See Also

https://redis.io/commands/srem/

Source

fn sscan<R: Response + DeserializeOwned>( self, key: impl Serialize, cursor: u64, options: SScanOptions<'_>, ) -> PreparedCommand<'a, Self, (u64, R)>

Iterates elements of Sets types.

§Return

a list of Set members.

§See Also

https://redis.io/commands/sscan/

Source

fn sunion<R: Response>( self, keys: impl Serialize, ) -> PreparedCommand<'a, Self, R>

Returns the members of the set resulting from the union of all the given sets.

§Return

A list with members of the resulting set.

§See Also

https://redis.io/commands/sunion/

Source

fn sunionstore( self, destination: impl Serialize, keys: impl Serialize, ) -> PreparedCommand<'a, Self, usize>

This command is equal to sunion, but instead of returning the resulting set, it is stored in destination.

§Return

The number of elements in the resulting set.

§See Also

https://redis.io/commands/sunionstore/

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> SetCommands<'a> for &'a Client

Source§

impl<'a> SetCommands<'a> for &'a mut Pipeline<'_>

Source§

impl<'a> SetCommands<'a> for &'a mut Transaction