Struct hedwig::publish::MockPublisher [−][src]
pub struct MockPublisher(_);
This is supported on crate feature
publish
only.Expand description
A mock publisher that stores messages in-memory for later verification.
This is useful primarily in tests.
Examples
use hedwig::publish::MockPublisher;
let publisher = MockPublisher::default();
let publisher_view = publisher.clone();
Implementations
Verify that a message was published. This method asserts that the message you expected to be published, was indeed published
Panics if the message was not published.
Trait Implementations
Returns the “default value” for a type. Read more
type MessageError = Infallible
type MessageError = Infallible
The error that this publisher returns when publishing of a message fails.
type PublishStream = MockPublishStream
type PublishStream = MockPublishStream
The stream of results that the publish
method returns.
fn publish<'a, I>(&self, topic: Topic, messages: I) -> Self::PublishStream where
I: Iterator<Item = &'a ValidatedMessage> + ExactSizeIterator,
fn publish<'a, I>(&self, topic: Topic, messages: I) -> Self::PublishStream where
I: Iterator<Item = &'a ValidatedMessage> + ExactSizeIterator,
Publish a batch of messages. Read more
Auto Trait Implementations
impl RefUnwindSafe for MockPublisher
impl Send for MockPublisher
impl Sync for MockPublisher
impl Unpin for MockPublisher
impl UnwindSafe for MockPublisher
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more