core_lib/events/
subscriber.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
use async_trait::async_trait;

use crate::events::{Error, Event};

#[async_trait]
pub trait Handler: Sync + Send {
    async fn handle(&self, event: &Event) -> Result<(), Error>;
}

#[async_trait]
pub trait Subscriber {
    async fn subscribe(&self, subject: &str, handler: Box<dyn Handler>) -> Result<(), Error>;
}