pub struct Pubsub<S>where
S: Spec + 'static,{ /* private fields */ }Expand description
Manager
Implementations§
Source§impl<S> Pubsub<S>where
S: Spec + 'static,
impl<S> Pubsub<S>where
S: Spec + 'static,
Sourcepub fn active_subscribers(&self) -> usize
pub fn active_subscribers(&self) -> usize
Total number of active subscribers, it is not the number of active topics being subscribed
Sourcepub fn publish_now<E>(&self, event: E) -> Result<(), Error>
pub fn publish_now<E>(&self, event: E) -> Result<(), Error>
Broadcast an event to all listeners right away, blocking the current thread
This function takes an Arc to the storage struct, the event_id, the kind and the vent to broadcast
Sourcepub fn subscribe_with<I>(
&self,
request: I,
sender: &Sender<(Arc<I::SubscriptionId>, S::Event)>,
receiver: Option<Receiver<(Arc<<S as Spec>::SubscriptionId>, <S as Spec>::Event)>>,
) -> Result<ActiveSubscription<S>, Error>where
I: SubscriptionRequest<Topic = <S::Event as Event>::Topic, SubscriptionId = S::SubscriptionId>,
pub fn subscribe_with<I>(
&self,
request: I,
sender: &Sender<(Arc<I::SubscriptionId>, S::Event)>,
receiver: Option<Receiver<(Arc<<S as Spec>::SubscriptionId>, <S as Spec>::Event)>>,
) -> Result<ActiveSubscription<S>, Error>where
I: SubscriptionRequest<Topic = <S::Event as Event>::Topic, SubscriptionId = S::SubscriptionId>,
Subscribe proving custom sender/receiver mpsc
Sourcepub fn subscribe<I>(&self, request: I) -> Result<ActiveSubscription<S>, Error>where
I: SubscriptionRequest<Topic = <S::Event as Event>::Topic, SubscriptionId = S::SubscriptionId>,
pub fn subscribe<I>(&self, request: I) -> Result<ActiveSubscription<S>, Error>where
I: SubscriptionRequest<Topic = <S::Event as Event>::Topic, SubscriptionId = S::SubscriptionId>,
Subscribe
Auto Trait Implementations§
impl<S> !Freeze for Pubsub<S>
impl<S> !RefUnwindSafe for Pubsub<S>
impl<S> Send for Pubsub<S>
impl<S> Sync for Pubsub<S>
impl<S> Unpin for Pubsub<S>
impl<S> !UnwindSafe for Pubsub<S>
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