use tokio::sync::{mpsc, watch};
use tokio_stream::wrappers::WatchStream;
mod commands;
pub use commands::ShojiCommand;
use crate::satellite::TatamiEvent;
#[derive(Debug, Clone)]
pub struct Shoji {
commander: mpsc::Sender<ShojiCommand>,
watcher: watch::Receiver<TatamiEvent>,
}
impl Shoji {
#[must_use]
pub fn new(
commander: mpsc::Sender<ShojiCommand>,
watcher: watch::Receiver<TatamiEvent>,
) -> Self {
Self { commander, watcher }
}
pub fn subscribe_all(&self) -> WatchStream<TatamiEvent> {
WatchStream::new(self.watcher.clone())
}
}