ras-events 2.6.0

Tokio broadcast event bus
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use async_trait::async_trait;
use ras_errors::AppError;

use crate::domain::browser_event::BrowserEvent;

#[async_trait]
pub trait EventBus: Send + Sync + 'static {
    async fn publish(&self, event: BrowserEvent) -> Result<(), AppError>;
    fn subscribe(&self) -> EventReceiver;
}

pub type EventReceiver = async_broadcast::Receiver<BrowserEvent>;