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