22 lines
444 B
Rust
22 lines
444 B
Rust
use once_cell::sync::Lazy;
|
|
use std::sync::Arc;
|
|
use tokio::sync::broadcast;
|
|
|
|
use super::event_bus::EventBus;
|
|
use crate::watcher::WatcherCommand;
|
|
|
|
pub enum ErrorEvent {
|
|
|
|
}
|
|
|
|
static ERROR_BUS: Lazy<Arc<EventBus<WatcherCommand>>> =
|
|
Lazy::new(|| Arc::new(EventBus::new()));
|
|
|
|
pub fn publish_error(event: WatcherCommand) {
|
|
ERROR_BUS.publish(event);
|
|
}
|
|
|
|
pub fn subscribe_error_bus() -> broadcast::Receiver<WatcherCommand> {
|
|
ERROR_BUS.subscribe()
|
|
}
|