[][src]Trait flo_stream::MessagePublisher

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 publish(&mut self, message: Self::Message) -> BoxFuture<'static, ()> { ... } }

Trait that provides functions for publishing messages to subscribers

Associated Types

type Message: 'static + Send

Loading content...

Required methods

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>>

Reserves a space for a message with the subscribers, returning when it's ready

fn when_empty(&mut self) -> BoxFuture<'static, ()>

Waits until all subscribers have consumed all pending messages

Loading content...

Provided methods

fn publish(&mut self, message: Self::Message) -> BoxFuture<'static, ()>

Publishes a message to the subscribers of this object

Loading content...

Implementors

impl<Message: 'static + Send + Clone> MessagePublisher for BlockingPublisher<Message>[src]

type Message = Message

fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Message>>[src]

Reserves a space for a message with the subscribers, returning when it's ready

fn when_empty(&mut self) -> BoxFuture<'static, ()>[src]

Waits until all subscribers have consumed all pending messages

impl<Message: 'static + Send + Clone> MessagePublisher for ExpiringPublisher<Message>[src]

type Message = Message

fn subscribe(&mut self) -> Subscriber<Message>[src]

Subscribes to this publisher

Subscribers only receive messages sent to the publisher after they are created.

fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Message>>[src]

Reserves a space for a message with the subscribers, returning when it's ready

fn when_empty(&mut self) -> BoxFuture<'static, ()>[src]

Waits until all subscribers have consumed all pending messages

impl<Message: 'static + Send + Clone> MessagePublisher for Publisher<Message>[src]

type Message = Message

fn subscribe(&mut self) -> Subscriber<Message>[src]

Subscribes to this publisher

Subscribers only receive messages sent to the publisher after they are created.

fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Message>>[src]

Reserves a space for a message with the subscribers, returning when it's ready

fn when_empty(&mut self) -> BoxFuture<'static, ()>[src]

Waits until all subscribers have consumed all pending messages

impl<Message: 'static + Send + Clone> MessagePublisher for SinglePublisher<Message>[src]

type Message = Message

fn subscribe(&mut self) -> Subscriber<Message>[src]

Subscribes to this publisher

Subscribers only receive messages sent to the publisher after they are created.

fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Message>>[src]

Reserves a space for a message with the subscribers, returning when it's ready

fn when_empty(&mut self) -> BoxFuture<'static, ()>[src]

Waits until all subscribers have consumed all pending messages

Loading content...