Struct evident::subscription::Subscription
source · pub struct Subscription<'p, K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,{ /* private fields */ }
Expand description
Subscription that is returned when subscribing to events captured by an EvidentPublisher
.
[req:subs]
Implementations§
source§impl<'p, K, M, T, F> Subscription<'p, K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,
impl<'p, K, M, T, F> Subscription<'p, K, M, T, F>where K: Id + CaptureControl, M: Msg, T: EventEntry<K, M>, F: Filter<K, M>,
sourcepub fn get_receiver(&self) -> &Receiver<Arc<Event<K, M, T>>>
pub fn get_receiver(&self) -> &Receiver<Arc<Event<K, M, T>>>
Get the Receiver
of the subscription channel.
sourcepub fn unsubscribe(self)
pub fn unsubscribe(self)
Unsubscribes this subscription.
sourcepub fn unsubscribe_id(&mut self, id: K) -> Result<(), SubscriptionError<K>>
pub fn unsubscribe_id(&mut self, id: K) -> Result<(), SubscriptionError<K>>
Unsubscribes from the given event-ID.
Note: Only possible for subscriptions to specific IDs.
Arguments
id
… Event-ID the subscription should be unsubscribed from
Possible Errors
SubscriptionError::IdNotSubscribed
… If athe given ID was not subscribed,SubscriptionError::UnsubscribeWouldDeleteSubscription
… If theSubscription
would not be subscribed to any ID afterwardsSubscriptionError::AllEventsSubscriptionNotModifiable
… If theSubscription
was created to receive all events
sourcepub fn unsubscribe_many(
&mut self,
ids: Vec<K>
) -> Result<(), SubscriptionError<K>>
pub fn unsubscribe_many( &mut self, ids: Vec<K> ) -> Result<(), SubscriptionError<K>>
Unsubscribes from the given list of event-IDs.
Note: Only possible for subscriptions to specific IDs.
Arguments
ids
… List of event-IDs the subscription should be unsubscribed from
Possible Errors
SubscriptionError::IdNotSubscribed
… If any of the given IDs was not subscribed,SubscriptionError::UnsubscribeWouldDeleteSubscription
… If theSubscription
would not be subscribed to any ID afterwardsSubscriptionError::AllEventsSubscriptionNotModifiable
… If theSubscription
was created to receive all events
sourcepub fn subscribe_id(&mut self, id: K) -> Result<(), SubscriptionError<K>>
pub fn subscribe_id(&mut self, id: K) -> Result<(), SubscriptionError<K>>
Subscribes to the given event-ID.
Note: Only possible for subscriptions to specific IDs.
Arguments
id
… Event-ID that should be added to the subscribed IDs by theSubscription
Possible Errors
SubscriptionError::IdAlreadySubscribed
… If the given ID is already subscribed,SubscriptionError::CouldNotAccessPublisher
… If theSubscription
has no connection to theEvidentPublisher
SubscriptionError::NoSubscriptionChannelAvailable
… If theEvidentPublisher
has no stored channel to thisSubscription
SubscriptionError::AllEventsSubscriptionNotModifiable
… If theSubscription
was created to receive all events
[req:subs.specific.one]
sourcepub fn subscribe_many(
&mut self,
ids: Vec<K>
) -> Result<(), SubscriptionError<K>>
pub fn subscribe_many( &mut self, ids: Vec<K> ) -> Result<(), SubscriptionError<K>>
Subscribes to the given list of event-IDs.
Note: Only possible for subscriptions to specific IDs.
Arguments
ids
… List of event-IDs that should be added to the subscribed IDs by theSubscription
Possible Errors
SubscriptionError::IdAlreadySubscribed
… If one of the given IDs is already subscribed,SubscriptionError::CouldNotAccessPublisher
… If theSubscription
has no connection to theEvidentPublisher
SubscriptionError::NoSubscriptionChannelAvailable
… If theEvidentPublisher
has no stored channel to thisSubscription
SubscriptionError::AllEventsSubscriptionNotModifiable
… If theSubscription
was created to receive all events
[req:subs.specific.mult]
Trait Implementations§
source§impl<'p, K, M, T, F> Drop for Subscription<'p, K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,
impl<'p, K, M, T, F> Drop for Subscription<'p, K, M, T, F>where K: Id + CaptureControl, M: Msg, T: EventEntry<K, M>, F: Filter<K, M>,
source§impl<'p, K, M, T, F> Hash for Subscription<'p, K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,
impl<'p, K, M, T, F> Hash for Subscription<'p, K, M, T, F>where K: Id + CaptureControl, M: Msg, T: EventEntry<K, M>, F: Filter<K, M>,
source§impl<'p, K, M, T, F> PartialEq<Subscription<'p, K, M, T, F>> for Subscription<'p, K, M, T, F>where
K: Id + CaptureControl,
M: Msg,
T: EventEntry<K, M>,
F: Filter<K, M>,
impl<'p, K, M, T, F> PartialEq<Subscription<'p, K, M, T, F>> for Subscription<'p, K, M, T, F>where K: Id + CaptureControl, M: Msg, T: EventEntry<K, M>, F: Filter<K, M>,
impl<'p, K, M, T, F> Eq for Subscription<'p, K, M, T, F>where K: Id + CaptureControl, M: Msg, T: EventEntry<K, M>, F: Filter<K, M>,
Auto Trait Implementations§
impl<'p, K, M, T, F> RefUnwindSafe for Subscription<'p, K, M, T, F>where F: RefUnwindSafe, K: RefUnwindSafe,
impl<'p, K, M, T, F> Send for Subscription<'p, K, M, T, F>where F: Sync,
impl<'p, K, M, T, F> !Sync for Subscription<'p, K, M, T, F>
impl<'p, K, M, T, F> Unpin for Subscription<'p, K, M, T, F>where K: Unpin,
impl<'p, K, M, T, F> UnwindSafe for Subscription<'p, K, M, T, F>where F: RefUnwindSafe, K: UnwindSafe,
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