Trait flo_stream::MessagePublisher [−][src]
pub trait MessagePublisher where
Self: Send, {
type Message: 'static + Send;
fn subscribe(&mut self) -> Subscriber<Self::Message>;
fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Self::Message>>;
fn when_empty(&mut self) -> BoxFuture<'static, ()>;
fn is_closed(&self) -> bool;
fn when_closed(&self) -> BoxFuture<'static, ()>;
fn publish(&mut self, message: Self::Message) -> BoxFuture<'static, ()> { ... }
}
Expand description
Trait that provides functions for publishing messages to subscribers
Associated Types
Required methods
fn subscribe(&mut self) -> Subscriber<Self::Message>
fn subscribe(&mut self) -> Subscriber<Self::Message>
Creates a subscription to this publisher
Any future messages sent here will also be sent to this subscriber.
fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Self::Message>>
fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Self::Message>>
Reserves a space for a message with the subscribers, returning when it’s ready
fn when_empty(&mut self) -> BoxFuture<'static, ()>
fn when_empty(&mut self) -> BoxFuture<'static, ()>
Waits until all subscribers have consumed all pending messages
Returns true if this publisher is closed (will not publish any further messages to its subscribers)
fn when_closed(&self) -> BoxFuture<'static, ()>
fn when_closed(&self) -> BoxFuture<'static, ()>
Future that returns when this publisher is closed