pub struct PubSub<C = Pin<Box<dyn AsyncStream + Send + Sync>>>(_);
Available on crate feature
aio
only.Expand description
Represents a PubSub
connection.
Implementations§
source§impl<C> PubSub<C>where
C: Unpin + AsyncRead + AsyncWrite + Send,
impl<C> PubSub<C>where
C: Unpin + AsyncRead + AsyncWrite + Send,
sourcepub async fn subscribe<T: ToRedisArgs>(&mut self, channel: T) -> RedisResult<()>
pub async fn subscribe<T: ToRedisArgs>(&mut self, channel: T) -> RedisResult<()>
Subscribes to a new channel.
sourcepub async fn psubscribe<T: ToRedisArgs>(
&mut self,
pchannel: T
) -> RedisResult<()>
pub async fn psubscribe<T: ToRedisArgs>(
&mut self,
pchannel: T
) -> RedisResult<()>
Subscribes to a new channel with a pattern.
sourcepub async fn unsubscribe<T: ToRedisArgs>(
&mut self,
channel: T
) -> RedisResult<()>
pub async fn unsubscribe<T: ToRedisArgs>(
&mut self,
channel: T
) -> RedisResult<()>
Unsubscribes from a channel.
sourcepub async fn punsubscribe<T: ToRedisArgs>(
&mut self,
pchannel: T
) -> RedisResult<()>
pub async fn punsubscribe<T: ToRedisArgs>(
&mut self,
pchannel: T
) -> RedisResult<()>
Unsubscribes from a channel with a pattern.
sourcepub fn on_message(&mut self) -> impl Stream<Item = Msg> + '_
pub fn on_message(&mut self) -> impl Stream<Item = Msg> + '_
sourcepub fn into_on_message(self) -> impl Stream<Item = Msg>
pub fn into_on_message(self) -> impl Stream<Item = Msg>
sourcepub async fn into_connection(self) -> Connection<C>
pub async fn into_connection(self) -> Connection<C>
Exits from PubSub
mode and converts PubSub
into Connection
.