pub struct Subscription {
pub id: SubscriberId,
pub channels: HashSet<ChannelId>,
pub filter: Option<EventFilter>,
pub created_at: u64,
pub active: bool,
pub metadata: SubscriptionMetadata,
}Expand description
A subscription to one or more channels.
Fields§
§id: SubscriberId§channels: HashSet<ChannelId>§filter: Option<EventFilter>§created_at: u64§active: bool§metadata: SubscriptionMetadataImplementations§
Source§impl Subscription
impl Subscription
Sourcepub fn new(id: impl Into<SubscriberId>) -> Self
pub fn new(id: impl Into<SubscriberId>) -> Self
Create a new subscription.
Sourcepub fn add_channel(&mut self, channel: impl Into<ChannelId>)
pub fn add_channel(&mut self, channel: impl Into<ChannelId>)
Add a channel to the subscription.
Sourcepub fn remove_channel(&mut self, channel: &ChannelId)
pub fn remove_channel(&mut self, channel: &ChannelId)
Remove a channel from the subscription.
Sourcepub fn with_filter(self, filter: EventFilter) -> Self
pub fn with_filter(self, filter: EventFilter) -> Self
Set the event filter.
Sourcepub fn is_subscribed_to(&self, channel: &ChannelId) -> bool
pub fn is_subscribed_to(&self, channel: &ChannelId) -> bool
Check if subscribed to a channel.
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate the subscription.
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
Returns a duplicate of the value. Read more
1.0.0 · 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 Subscription
impl Debug for Subscription
Source§impl<'de> Deserialize<'de> for Subscription
impl<'de> Deserialize<'de> for Subscription
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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