pub struct NoOpPublisher<E> { /* private fields */ }Expand description
A no-op implementation of any event publishing contract.
Accepts any event type, discards it silently, and returns Ok(()).
Use this as the default publisher in generated services so that
Option<Publisher> is never needed.
§Example
ⓘ
use backbone_messaging::NoOpPublisher;
let publisher: NoOpPublisher<MyEvent> = NoOpPublisher::new();
publisher.publish(my_event).await?; // does nothingImplementations§
Source§impl<E> NoOpPublisher<E>
impl<E> NoOpPublisher<E>
Trait Implementations§
Source§impl<E> Default for NoOpPublisher<E>
impl<E> Default for NoOpPublisher<E>
Source§impl<E: Send + Sync + 'static> Publisher<E> for NoOpPublisher<E>
impl<E: Send + Sync + 'static> Publisher<E> for NoOpPublisher<E>
fn publish<'life0, 'async_trait>(
&'life0 self,
_event: E,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish_many<'life0, 'async_trait>(
&'life0 self,
_events: Vec<E>,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<E> Freeze for NoOpPublisher<E>where
PhantomData<E>: Freeze,
impl<E> RefUnwindSafe for NoOpPublisher<E>where
PhantomData<E>: RefUnwindSafe,
impl<E> Send for NoOpPublisher<E>where
PhantomData<E>: Send,
impl<E> Sync for NoOpPublisher<E>where
PhantomData<E>: Sync,
impl<E> Unpin for NoOpPublisher<E>where
PhantomData<E>: Unpin,
impl<E> UnsafeUnpin for NoOpPublisher<E>where
PhantomData<E>: UnsafeUnpin,
impl<E> UnwindSafe for NoOpPublisher<E>where
PhantomData<E>: 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