in midst of refactor

This commit is contained in:
2024-04-29 21:46:42 +02:00
parent ed0d64d52e
commit aa3f7e99ab
221 changed files with 5431 additions and 685 deletions

View File

@@ -0,0 +1,13 @@
use std::sync::{Arc, Mutex};
pub struct DeleteCell<T>(pub Arc<Mutex<Option<T>>>);
impl<T> DeleteCell<T> {
pub fn new(t: T) -> Self { Self(Arc::new(Mutex::new(Some(t)))) }
pub fn take(&self) -> Option<T> { self.0.lock().unwrap().take() }
}
impl<T: Clone> DeleteCell<T> {
pub fn clone_out(&self) -> Option<T> { self.0.lock().unwrap().clone() }
}
impl<T> Clone for DeleteCell<T> {
fn clone(&self) -> Self { Self(self.0.clone()) }
}