ephemeral logins

This commit is contained in:
Aiden McClelland
2024-07-26 12:29:59 -06:00
parent e0b47feb8b
commit a3b94816f9
9 changed files with 87 additions and 29 deletions

View File

@@ -0,0 +1,9 @@
pub struct SyncMutex<T>(std::sync::Mutex<T>);
impl<T> SyncMutex<T> {
pub fn new(t: T) -> Self {
Self(std::sync::Mutex::new(t))
}
pub fn mutate<F: FnOnce(&mut T) -> U, U>(&self, f: F) -> U {
f(&mut *self.0.lock().unwrap())
}
}