blob: 6306546c31876be4969bbd32e156a277cf0c86d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
use std::sync::Arc;
use i3bar::Block;
use tokio::sync::{Notify, RwLock};
pub use crate::error::{Error, Result};
pub mod dbus;
pub mod error;
pub mod i3bar;
pub mod listener;
pub type Blocks = Arc<Watcher<[Option<Block>; 6]>>;
#[derive(Default)]
pub struct Watcher<T> {
pub value: RwLock<T>,
pub notify: Notify,
}
impl<T> Watcher<T> {
pub fn new(value: T) -> Self {
Self {
value: RwLock::new(value),
notify: Notify::new(),
}
}
}
|