pub trait EventSource {
// Required method
fn spawn<F, Fut>(&self, on_event: F) -> JoinHandle<Result<()>>
where F: Fn(AgentEvent) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Option<String>> + Send + 'static;
}
Expand description
An event source listens for events, and calls the on_event
callback to react to events.
Required Methods§
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.