Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler<E> {
    type Publish: Publisher<E>;

    // Required method
    fn init() -> (Self::Publish, Self);
}
Expand description

Constructs the read side of an event stream, paired with its Publisher write end. A producer holds impl EventHandler so it can both emit (through Publish) and hand out subscriptions (through the handler itself), with no bound on the event type. Send + Sync is required by the sharer (a cross-thread producer), not here.

Required Associated Types§

Source

type Publish: Publisher<E>

The write end paired with this handler.

Required Methods§

Source

fn init() -> (Self::Publish, Self)

Build a fresh (publisher, handler) sharing one stream.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§