pub struct SubscriptionManager { /* private fields */ }Expand description
Map of active subscriptions, keyed by SubscriptionId.
Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
Sourcepub fn publish(&self, envelope: &Envelope) -> usize
pub fn publish(&self, envelope: &Envelope) -> usize
Publish envelope to all subscribers; lossy under backpressure.
Returns the number of subscribers the message was delivered to.
Sourcepub fn register(
&self,
filter: SubscriptionFilter,
session_id: SessionId,
) -> (SubscriptionId, FilteredReceiver)
pub fn register( &self, filter: SubscriptionFilter, session_id: SessionId, ) -> (SubscriptionId, FilteredReceiver)
Register a new subscription. Returns the new id and a receiver.
Sourcepub fn unsubscribe(&self, id: &SubscriptionId) -> bool
pub fn unsubscribe(&self, id: &SubscriptionId) -> bool
Tear down a subscription. Returns whether it existed.
Sourcepub fn drop_session(&self, session_id: &SessionId)
pub fn drop_session(&self, session_id: &SessionId)
Drop every subscription owned by session_id (e.g. on eviction).
Trait Implementations§
Source§impl Clone for SubscriptionManager
impl Clone for SubscriptionManager
Source§fn clone(&self) -> SubscriptionManager
fn clone(&self) -> SubscriptionManager
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 SubscriptionManager
impl Debug for SubscriptionManager
Auto Trait Implementations§
impl Freeze for SubscriptionManager
impl !RefUnwindSafe for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin for SubscriptionManager
impl UnsafeUnpin for SubscriptionManager
impl !UnwindSafe for SubscriptionManager
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