Trait fred::interfaces::PubsubInterface

source ·
pub trait PubsubInterface: ClientLike + Sized {
Show 13 methods // Provided methods fn subscribe<S>(&self, channels: S) -> impl Future<Output = RedisResult<()>> where S: Into<MultipleStrings> { ... } fn unsubscribe<S>( &self, channels: S, ) -> impl Future<Output = RedisResult<()>> where S: Into<MultipleStrings> { ... } fn psubscribe<S>( &self, patterns: S, ) -> impl Future<Output = RedisResult<()>> where S: Into<MultipleStrings> { ... } fn punsubscribe<S>( &self, patterns: S, ) -> impl Future<Output = RedisResult<()>> where S: Into<MultipleStrings> { ... } fn publish<R, S, V>( &self, channel: S, message: V, ) -> impl Future<Output = RedisResult<R>> where R: FromRedis, S: Into<Str>, V: TryInto<RedisValue>, V::Error: Into<RedisError> { ... } fn ssubscribe<C>( &self, channels: C, ) -> impl Future<Output = RedisResult<()>> where C: Into<MultipleStrings> { ... } fn sunsubscribe<C>( &self, channels: C, ) -> impl Future<Output = RedisResult<()>> where C: Into<MultipleStrings> { ... } fn spublish<R, S, V>( &self, channel: S, message: V, ) -> impl Future<Output = RedisResult<R>> where R: FromRedis, S: Into<Str>, V: TryInto<RedisValue>, V::Error: Into<RedisError> { ... } fn pubsub_channels<R, S>( &self, pattern: S, ) -> impl Future<Output = RedisResult<R>> where R: FromRedis, S: Into<Str> { ... } fn pubsub_numpat<R>(&self) -> impl Future<Output = RedisResult<R>> where R: FromRedis { ... } fn pubsub_numsub<R, S>( &self, channels: S, ) -> impl Future<Output = RedisResult<R>> where R: FromRedis, S: Into<MultipleStrings> { ... } fn pubsub_shardchannels<R, S>( &self, pattern: S, ) -> impl Future<Output = RedisResult<R>> where R: FromRedis, S: Into<Str> { ... } fn pubsub_shardnumsub<R, S>( &self, channels: S, ) -> impl Future<Output = RedisResult<R>> where R: FromRedis, S: Into<MultipleStrings> { ... }
}
Available on crate feature i-pubsub only.
Expand description

Functions that implement the pubsub interface.

Provided Methods§

source

fn subscribe<S>(&self, channels: S) -> impl Future<Output = RedisResult<()>>

Subscribe to a channel on the publish-subscribe interface.

https://redis.io/commands/subscribe

source

fn unsubscribe<S>(&self, channels: S) -> impl Future<Output = RedisResult<()>>

Unsubscribe from a channel on the PubSub interface.

https://redis.io/commands/unsubscribe

source

fn psubscribe<S>(&self, patterns: S) -> impl Future<Output = RedisResult<()>>

Subscribes the client to the given patterns.

https://redis.io/commands/psubscribe

source

fn punsubscribe<S>(&self, patterns: S) -> impl Future<Output = RedisResult<()>>

Unsubscribes the client from the given patterns, or from all of them if none is given.

If no channels are provided this command returns an empty array.

https://redis.io/commands/punsubscribe

source

fn publish<R, S, V>( &self, channel: S, message: V, ) -> impl Future<Output = RedisResult<R>>
where R: FromRedis, S: Into<Str>, V: TryInto<RedisValue>, V::Error: Into<RedisError>,

Publish a message on the PubSub interface, returning the number of clients that received the message.

https://redis.io/commands/publish

source

fn ssubscribe<C>(&self, channels: C) -> impl Future<Output = RedisResult<()>>

Subscribes the client to the specified shard channels.

https://redis.io/commands/ssubscribe/

source

fn sunsubscribe<C>(&self, channels: C) -> impl Future<Output = RedisResult<()>>

Unsubscribes the client from the given shard channels, or from all of them if none is given.

If no channels are provided this command returns an empty array.

https://redis.io/commands/sunsubscribe/

source

fn spublish<R, S, V>( &self, channel: S, message: V, ) -> impl Future<Output = RedisResult<R>>
where R: FromRedis, S: Into<Str>, V: TryInto<RedisValue>, V::Error: Into<RedisError>,

Posts a message to the given shard channel.

https://redis.io/commands/spublish/

source

fn pubsub_channels<R, S>( &self, pattern: S, ) -> impl Future<Output = RedisResult<R>>
where R: FromRedis, S: Into<Str>,

Lists the currently active channels.

https://redis.io/commands/pubsub-channels/

source

fn pubsub_numpat<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,

Returns the number of unique patterns that are subscribed to by clients.

https://redis.io/commands/pubsub-numpat/

source

fn pubsub_numsub<R, S>( &self, channels: S, ) -> impl Future<Output = RedisResult<R>>

Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified channels.

https://redis.io/commands/pubsub-numsub/

source

fn pubsub_shardchannels<R, S>( &self, pattern: S, ) -> impl Future<Output = RedisResult<R>>
where R: FromRedis, S: Into<Str>,

Lists the currently active shard channels.

https://redis.io/commands/pubsub-shardchannels/

source

fn pubsub_shardnumsub<R, S>( &self, channels: S, ) -> impl Future<Output = RedisResult<R>>

Returns the number of subscribers for the specified shard channels.

https://redis.io/commands/pubsub-shardnumsub/

Object Safety§

This trait is not object safe.

Implementors§