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
29
30
use crate::voice::{self, events::VoiceEvent};
use parking_lot::RwLock;
pub use voice::events::VoiceSettingsUpdateEvent as VoiceStateInner;
pub struct VoiceState {
pub state: RwLock<VoiceStateInner>,
}
impl VoiceState {
pub fn new() -> Self {
Self {
state: RwLock::new(VoiceStateInner::default()),
}
}
pub fn on_event(&self, ve: VoiceEvent) {
match ve {
VoiceEvent::Refresh(refresh) => {
*self.state.write() = refresh;
}
}
}
}
impl Default for VoiceState {
fn default() -> Self {
Self::new()
}
}