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§
Sourcetype NotifyFuture: Future<Output = Result<(), ClosedClient>> + Send + Unpin
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§
Sourcefn notify(&self, event: Self::Event) -> Self::NotifyFuture
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.