pub trait PubSubBehavior<T> {
    fn get_message_with_context(
        &self,
        next_message_id: &mut u64,
        cx: Option<&mut Context<'_>>
    ) -> Poll<WaitResult<T>>; fn available(&self, next_message_id: u64) -> u64; fn publish_with_context(
        &self,
        message: T,
        cx: Option<&mut Context<'_>>
    ) -> Result<(), T>; fn publish_immediate(&self, message: T); fn space(&self) -> usize; fn unregister_subscriber(&self, subscriber_next_message_id: u64); fn unregister_publisher(&self); }
Expand description

‘Middle level’ behaviour of the pubsub channel. This trait is used so that Sub and Pub can be generic over the channel.

Required Methods

Try to get a message from the queue with the given message id.

If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers.

Get the amount of messages that are between the given the next_message_id and the most recent message. This is not necessarily the amount of messages a subscriber can still received as it may have lagged.

Try to publish a message to the queue.

If the queue is full and a context is given, then its waker is registered in the publisher wakers.

Publish a message immediately

The amount of messages that can still be published without having to wait or without having to lag the subscribers

Let the channel know that a subscriber has dropped

Let the channel know that a publisher has dropped

Implementors