Skip to main content

FallibleObserver

Trait FallibleObserver 

Source
pub trait FallibleObserver: Send + Sync {
    // Required method
    fn try_handle_event(&self, event: &AgentEvent) -> Result<(), ReportError>;
}
Expand description

A reporter whose event handling can fail.

Implement this trait for reporters that perform I/O or other fallible operations. Wrap the implementation in PolicyReporter to obtain a LoopObserver with configurable error handling.

Required Methods§

Source

fn try_handle_event(&self, event: &AgentEvent) -> Result<(), ReportError>

Process an event, returning an error if something goes wrong. Implementations store mutable state behind interior mutability so the wrapper can be shared as Arc<dyn LoopObserver>.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§