use async_trait::async_trait; use std::fmt::Debug; pub trait Event: Send + Sync + Debug { fn id(&self) -> i64; fn event_type(&self) -> &str; } #[async_trait] pub trait EventSource: Send + Sync { type Event: Event; type Error: std::error::Error + Send + Sync + 'static; async fn connect(&mut self) -> Result<(), Self::Error>; async fn next_event(&mut self) -> Result; fn is_connected(&self) -> bool; async fn disconnect(&mut self) -> Result<(), Self::Error>; }