pub trait Subscriber: Send {
type Message: IncomingMessage;
type Error: StdError + Send + Sync + 'static;
// Required method
fn stream(
&mut self,
) -> impl Stream<Item = Result<Self::Message, Self::Error>> + Send + '_;
}Expand description
A consumer attached to one or more broker names.
Subscriber yields messages via a Stream, so users get back-pressure and integration with
the rest of the futures ecosystem for free. Each yielded item is a broker-specific
IncomingMessage that must be acknowledged.
§Cancel safety
Polling stream is cancel-safe: dropping the returned Stream between polls is allowed.
Implementations must not buffer partially-decoded frames in &self state; if buffering is
required, it belongs in &mut self.
Required Associated Types§
Sourcetype Message: IncomingMessage
type Message: IncomingMessage
The message type yielded by this subscriber.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".