Audio settings: Sinks and sources control fully implemented (cards wip), port pactl_wrapper
This commit is contained in:
21
dash-frontend/src/task.rs
Normal file
21
dash-frontend/src/task.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use std::{cell::RefCell, collections::VecDeque, rc::Rc};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Tasks<TaskType>(Rc<RefCell<VecDeque<TaskType>>>)
|
||||
where
|
||||
TaskType: Clone;
|
||||
|
||||
impl<TaskType: Clone + 'static> Tasks<TaskType> {
|
||||
pub fn new() -> Self {
|
||||
Self(Rc::new(RefCell::new(VecDeque::new())))
|
||||
}
|
||||
|
||||
pub fn push(&self, task: TaskType) {
|
||||
self.0.borrow_mut().push_back(task);
|
||||
}
|
||||
|
||||
pub fn drain(&mut self) -> VecDeque<TaskType> {
|
||||
let mut tasks = self.0.borrow_mut();
|
||||
std::mem::take(&mut *tasks)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user