Skip to main content

EventSink

Trait EventSink 

Source
pub trait EventSink {
    // Required method
    fn deliver(&self, event: &Value) -> Result<(), EmitError>;

    // Provided methods
    fn is_open(&self) -> bool { ... }
    fn record_failure(&self, _error: &EmitError) { ... }
}
Expand description

The representation’s destination for one emitted event.

deliver returns once the value has been rendered or framed and written, so the handler’s next statement runs after the consumer could read it. It returns Err for every reason the event did not reach the destination, so the handler’s ? stops at the emit that failed.

Required Methods§

Source

fn deliver(&self, event: &Value) -> Result<(), EmitError>

Provided Methods§

Source

fn is_open(&self) -> bool

False once the destination has gone away; nothing further is written.

Source

fn record_failure(&self, _error: &EmitError)

Remembers a failure the channel raised before reaching deliver, so a value that never became an event fails the run the way one the destination refused does, whether or not the handler propagates it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§