Skip to main content

EventSource

Trait EventSource 

Source
pub trait EventSource: Send + Sync {
    // Required method
    fn next(&self, cx: &mut Cx) -> Result<Option<Event>>;

    // Provided method
    fn close(&self, _cx: &mut Cx) -> Result<()> { ... }
}
Expand description

A source that produces a run’s events in order.

The kernel defines the pull contract; libraries supply the production.

Required Methods§

Source

fn next(&self, cx: &mut Cx) -> Result<Option<Event>>

Pull the next event, or None when the source is exhausted.

Provided Methods§

Source

fn close(&self, _cx: &mut Cx) -> Result<()>

Release the source’s resources; the default is a no-op.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§