Skip to main content

EventSource

Trait EventSource 

Source
pub trait EventSource: Send + 'static {
    // Required method
    fn recv(&mut self) -> impl Future<Output = Option<RawEvent>> + Send;
}
Expand description

Contract for event input adapters.

Each source reads events from a specific input (stdin, HTTP, NATS) and yields RawEvents containing the raw payload and an acknowledgment token. Sources are used as concrete types (not dyn), so async fn is valid without object-safety concerns.

Required Methods§

Source

fn recv(&mut self) -> impl Future<Output = Option<RawEvent>> + Send

Receive the next event with its ack token. Returns None when the source is exhausted or shutting down.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§