1#![expect(
2 clippy::disallowed_types,
3 reason = "this module is the canonical definition of the allowed lock types"
4)]
5use std::sync::Arc;
8
9use tokio::sync::{Mutex, RwLock};
10
11pub type SyncMutex<T> = parking_lot::Mutex<T>;
13pub type SyncRwLock<T> = parking_lot::RwLock<T>;
15
16pub type AsyncMutex<T> = Mutex<T>;
18pub type AsyncRwLock<T> = RwLock<T>;
20
21pub type Shared<T> = Arc<SyncMutex<T>>;
23
24pub fn shared<T>(value: T) -> Shared<T> {
26 Arc::new(SyncMutex::new(value))
27}
28
29pub trait IntoShared: Sized {
31 fn into_shared(self) -> Shared<Self> {
33 Arc::new(SyncMutex::new(self))
34 }
35}
36
37impl<T> IntoShared for T {}