pub struct StreamBus<B: StreamBackend> { /* private fields */ }Implementations§
Source§impl<B: StreamBackend> StreamBus<B>
impl<B: StreamBackend> StreamBus<B>
pub fn new( backend: Arc<B>, options: StreamBusOptions, ) -> Result<Self, EventBusError>
pub async fn publish( &self, msg: Message, opts: PublishOptions, ) -> Result<MessageId, EventBusError>
pub async fn publish_batch( &self, msgs: Vec<Message>, opts: PublishOptions, ) -> Result<BatchOutcome, EventBusError>
Sourcepub async fn subscribe<H>(
&self,
cfg: SubscriptionConfig,
handler: H,
) -> Result<StreamSubscription, EventBusError>where
H: Handler + 'static,
pub async fn subscribe<H>(
&self,
cfg: SubscriptionConfig,
handler: H,
) -> Result<StreamSubscription, EventBusError>where
H: Handler + 'static,
Convenience: subscribe with a concrete handler value, returning a
concrete StreamSubscription (not the trait object). For dyn
dispatch use the Subscriber trait directly.
Trait Implementations§
Source§impl<B: StreamBackend> Clone for StreamBus<B>
impl<B: StreamBackend> Clone for StreamBus<B>
Source§impl<B: StreamBackend> Publisher for StreamBus<B>
impl<B: StreamBackend> Publisher for StreamBus<B>
fn publish( &self, msg: Message, opts: PublishOptions, ) -> BoxFuture<'_, Result<MessageId, EventBusError>>
fn publish_batch( &self, msgs: Vec<Message>, opts: PublishOptions, ) -> BoxFuture<'_, Result<BatchOutcome, EventBusError>>
Source§impl<B: StreamBackend> Subscriber for StreamBus<B>
impl<B: StreamBackend> Subscriber for StreamBus<B>
fn subscribe( &self, cfg: SubscriptionConfig, handler: Arc<dyn Handler>, ) -> BoxFuture<'_, Result<Arc<dyn Subscription>, EventBusError>>
Auto Trait Implementations§
impl<B> !RefUnwindSafe for StreamBus<B>
impl<B> !UnwindSafe for StreamBus<B>
impl<B> Freeze for StreamBus<B>
impl<B> Send for StreamBus<B>
impl<B> Sync for StreamBus<B>
impl<B> Unpin for StreamBus<B>
impl<B> UnsafeUnpin for StreamBus<B>
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
impl<T> Bus for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<P> PublisherExt for P
impl<P> PublisherExt for P
Source§fn publish_iter<I>(
&self,
msgs: I,
opts: PublishOptions,
) -> BoxFuture<'_, Result<BatchOutcome, EventBusError>>
fn publish_iter<I>( &self, msgs: I, opts: PublishOptions, ) -> BoxFuture<'_, Result<BatchOutcome, EventBusError>>
Publish an iterator of messages. Collects into
Vec and delegates
to Publisher::publish_batch. The collect is mandatory because the
dyn-safe publish_batch cannot accept an opaque iterator.