pub struct Consumer<T>where
T: Transport + 'static,{ /* private fields */ }Expand description
Subscription consumer
Implementations§
Source§impl<T> Consumer<T>where
T: Transport + 'static,
impl<T> Consumer<T>where
T: Transport + 'static,
Sourcepub fn new(
transport: T,
prefer_polling: bool,
context: <T::Spec as Spec>::Context,
) -> Arc<Self> ⓘ
pub fn new( transport: T, prefer_polling: bool, context: <T::Spec as Spec>::Context, ) -> Arc<Self> ⓘ
Creates a new instance
Sourcepub fn subscribe<I>(
self: &Arc<Self>,
request: I,
) -> Result<RemoteActiveConsumer<T>, Error>where
I: SubscriptionRequest<Topic = <T::Spec as Spec>::Topic, SubscriptionId = <T::Spec as Spec>::SubscriptionId>,
pub fn subscribe<I>(
self: &Arc<Self>,
request: I,
) -> Result<RemoteActiveConsumer<T>, Error>where
I: SubscriptionRequest<Topic = <T::Spec as Spec>::Topic, SubscriptionId = <T::Spec as Spec>::SubscriptionId>,
Creates a subscription
The subscriptions have two parts:
-
Will create the subscription to the remote Pubsub service, Any events will be moved to the internal pubsub
-
The internal subscription to the inner Pubsub. Because all subscriptions are going the transport, once events matches subscriptions, the inner_pubsub will receive the message and broadcasat the event.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Consumer<T>
impl<T> !RefUnwindSafe for Consumer<T>
impl<T> !UnwindSafe for Consumer<T>
impl<T> Send for Consumer<T>where
Arc<Pubsub<<T as Transport>::Spec>>: Send,
Arc<RwLock<RawRwLock, HashMap<<<T as Transport>::Spec as Spec>::Topic, UniqueSubscription<<T as Transport>::Spec>>>>: Send,
RwLock<RawRwLock, HashMap<Arc<<<T as Transport>::Spec as Spec>::SubscriptionId>, Vec<<<T as Transport>::Spec as Spec>::Topic>>>: Send,
RwLock<RawRwLock, Option<Sender<StreamCtrl<<T as Transport>::Spec>>>>: Send,
Arc<RwLock<RawRwLock, HashMap<<<<T as Transport>::Spec as Spec>::Event as Event>::Topic, <<T as Transport>::Spec as Spec>::Event>>>: Send,
impl<T> Sync for Consumer<T>where
Arc<Pubsub<<T as Transport>::Spec>>: Sync,
Arc<RwLock<RawRwLock, HashMap<<<T as Transport>::Spec as Spec>::Topic, UniqueSubscription<<T as Transport>::Spec>>>>: Sync,
RwLock<RawRwLock, HashMap<Arc<<<T as Transport>::Spec as Spec>::SubscriptionId>, Vec<<<T as Transport>::Spec as Spec>::Topic>>>: Sync,
RwLock<RawRwLock, Option<Sender<StreamCtrl<<T as Transport>::Spec>>>>: Sync,
Arc<RwLock<RawRwLock, HashMap<<<<T as Transport>::Spec as Spec>::Event as Event>::Topic, <<T as Transport>::Spec as Spec>::Event>>>: Sync,
impl<T> Unpin for Consumer<T>where
T: Unpin,
Arc<Pubsub<<T as Transport>::Spec>>: Unpin,
Arc<RwLock<RawRwLock, HashMap<<<T as Transport>::Spec as Spec>::Topic, UniqueSubscription<<T as Transport>::Spec>>>>: Unpin,
RwLock<RawRwLock, HashMap<Arc<<<T as Transport>::Spec as Spec>::SubscriptionId>, Vec<<<T as Transport>::Spec as Spec>::Topic>>>: Unpin,
RwLock<RawRwLock, Option<Sender<StreamCtrl<<T as Transport>::Spec>>>>: Unpin,
Arc<RwLock<RawRwLock, HashMap<<<<T as Transport>::Spec as Spec>::Event as Event>::Topic, <<T as Transport>::Spec as Spec>::Event>>>: Unpin,
impl<T> UnsafeUnpin for Consumer<T>where
T: UnsafeUnpin,
Arc<Pubsub<<T as Transport>::Spec>>: UnsafeUnpin,
Arc<RwLock<RawRwLock, HashMap<<<T as Transport>::Spec as Spec>::Topic, UniqueSubscription<<T as Transport>::Spec>>>>: UnsafeUnpin,
RwLock<RawRwLock, HashMap<Arc<<<T as Transport>::Spec as Spec>::SubscriptionId>, Vec<<<T as Transport>::Spec as Spec>::Topic>>>: UnsafeUnpin,
RwLock<RawRwLock, Option<Sender<StreamCtrl<<T as Transport>::Spec>>>>: UnsafeUnpin,
Arc<RwLock<RawRwLock, HashMap<<<<T as Transport>::Spec as Spec>::Event as Event>::Topic, <<T as Transport>::Spec as Spec>::Event>>>: UnsafeUnpin,
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