Something went wrong. Try again.
A simple to-do app focused on tasks that can be completed within a specific time span. taskline.tobinio.dev
Something went wrong. Try again.
Rust
at rust-backend
12345678910111213141516171819202122232425262728293031use tokio::sync::broadcast;
#[derive(Clone)]pub enum Event { Tag(String), Category(String), Todo(String),}
#[derive(Clone)]pub struct EventService { tx: broadcast::Sender<Event>,}
impl Default for EventService { fn default() -> Self { let tx = broadcast::Sender::new(64); Self { tx } }}
impl EventService { pub fn broadcast(&self, event: Event) { let _ = self.tx.send(event); }
pub fn subscribe(&self) -> broadcast::Receiver<Event> { self.tx.subscribe() }}