event_queue

Trait Notify

Source
pub trait Notify {
    type Event: Event;
    type NotifyFuture: Future<Output = Result<(), ClosedClient>> + Send + Unpin;

    // Required method
    fn notify(&self, event: Self::Event) -> Self::NotifyFuture;
}
Expand description

This trait defines how an event should be notified for a client. The struct that implements this trait can hold client specific data.

Required Associated Types§

Source

type Event: Event

The type of the event that can be sent through this notification channel.

Source

type NotifyFuture: Future<Output = Result<(), ClosedClient>> + Send + Unpin

The type of the future that will resolve when the client acknowledges the event or the client is lost.

Required Methods§

Source

fn notify(&self, event: Self::Event) -> Self::NotifyFuture

If the event was notified successfully, the future should return Ok(()), otherwise if the client is closed, the future should return Err(ClosedClient) which will results in the corresponding client being removed from the event queue.

Implementors§