pub struct RedisPubSub { /* private fields */ }Expand description
Describes one Pub/Sub subscription against crate::RedisBroker.
§Examples
use ruststream_fred::{PubSubMode, RedisPubSub};
let classic = RedisPubSub::new("events");
let sharded = RedisPubSub::new("events").mode(PubSubMode::Sharded);
let pattern = RedisPubSub::new("events.*").pattern(); // classic onlyImplementations§
Source§impl RedisPubSub
impl RedisPubSub
Sourcepub fn new(channel: impl Into<String>) -> Self
pub fn new(channel: impl Into<String>) -> Self
A subscription on channel (an exact channel by default; see pattern).
Sourcepub const fn mode(self, mode: PubSubMode) -> Self
pub const fn mode(self, mode: PubSubMode) -> Self
Sets the delivery mode. Defaults to PubSubMode::Classic.
Sourcepub const fn pattern(self) -> Self
pub const fn pattern(self) -> Self
Treats the channel as a glob pattern (PSUBSCRIBE). Classic mode only; combining it with
PubSubMode::Sharded is rejected at subscribe time.
Trait Implementations§
Source§impl Clone for RedisPubSub
impl Clone for RedisPubSub
Source§fn clone(&self) -> RedisPubSub
fn clone(&self) -> RedisPubSub
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RedisPubSub
impl Debug for RedisPubSub
Source§impl SubscriptionSource<RedisBroker> for RedisPubSub
impl SubscriptionSource<RedisBroker> for RedisPubSub
Source§type Subscriber = RedisPubSubSubscriber
type Subscriber = RedisPubSubSubscriber
The subscriber type this source opens.
Source§async fn subscribe(
self,
broker: &RedisBroker,
) -> Result<Self::Subscriber, RedisError>
async fn subscribe( self, broker: &RedisBroker, ) -> Result<Self::Subscriber, RedisError>
Auto Trait Implementations§
impl !RefUnwindSafe for RedisPubSub
impl !UnwindSafe for RedisPubSub
impl Freeze for RedisPubSub
impl Send for RedisPubSub
impl Sync for RedisPubSub
impl Unpin for RedisPubSub
impl UnsafeUnpin for RedisPubSub
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more