Skip to main content

fraktor_utils_std_rs/runtime_toolbox/
std_mutex_family.rs

1use fraktor_utils_core_rs::runtime_toolbox::SyncMutexFamily;
2
3use crate::StdSyncMutex;
4
5/// Mutex family backed by [`std::sync::Mutex`].
6#[derive(Clone, Copy, Debug, Default)]
7pub struct StdMutexFamily;
8
9impl SyncMutexFamily for StdMutexFamily {
10  type Mutex<T>
11    = StdSyncMutex<T>
12  where
13    T: Send + 'static;
14
15  fn create<T>(value: T) -> Self::Mutex<T>
16  where
17    T: Send + 'static, {
18    StdSyncMutex::new(value)
19  }
20}