pub struct SubscriptionManager { /* private fields */ }Expand description
Subscription manager with capacity limits.
Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
Sourcepub fn new(max_subscriptions: usize) -> SubscriptionManager
pub fn new(max_subscriptions: usize) -> SubscriptionManager
Creates a new subscription manager with the specified maximum capacity.
Sourcepub fn with_default_capacity() -> SubscriptionManager
pub fn with_default_capacity() -> SubscriptionManager
Creates a new subscription manager with the default maximum capacity (100).
Sourcepub fn max_subscriptions(&self) -> usize
pub fn max_subscriptions(&self) -> usize
Returns the maximum number of subscriptions allowed.
Sourcepub fn try_add(
&self,
key: String,
subscription: Subscription,
) -> Result<(), Error>
pub fn try_add( &self, key: String, subscription: Subscription, ) -> Result<(), Error>
Attempts to add a subscription.
Sourcepub fn remove(&self, key: &str) -> Option<Subscription>
pub fn remove(&self, key: &str) -> Option<Subscription>
Removes a subscription by key.
Sourcepub fn remaining_capacity(&self) -> usize
pub fn remaining_capacity(&self) -> usize
Returns the remaining capacity for new subscriptions.
Sourcepub fn get(&self, key: &str) -> Option<Ref<'_, String, Subscription>>
pub fn get(&self, key: &str) -> Option<Ref<'_, String, Subscription>>
Returns a reference to the subscription for the given key, if it exists.
Sourcepub fn iter(&self) -> impl Iterator<Item = RefMulti<'_, String, Subscription>>
pub fn iter(&self) -> impl Iterator<Item = RefMulti<'_, String, Subscription>>
Returns an iterator over all subscriptions.
Sourcepub fn collect_subscriptions(&self) -> Vec<Subscription>
pub fn collect_subscriptions(&self) -> Vec<Subscription>
Collects all subscriptions into a vector.
Trait Implementations§
Source§impl Debug for SubscriptionManager
impl Debug for SubscriptionManager
Source§impl Default for SubscriptionManager
impl Default for SubscriptionManager
Source§fn default() -> SubscriptionManager
fn default() -> SubscriptionManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SubscriptionManager
impl !RefUnwindSafe for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin 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