From 17761af5a856ed758ce420e36aaa18382415ef13 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sat, 10 Jul 2021 13:05:41 +0200 Subject: [PATCH] Add type aliases for mapped mutex guards --- src/parkinglot.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/parkinglot.rs b/src/parkinglot.rs index 7158623..5d44ab1 100644 --- a/src/parkinglot.rs +++ b/src/parkinglot.rs @@ -27,6 +27,9 @@ debug_variant!(DebugRawRwLock, TracingRawRwLock, parking_lot::RawRwLock); pub type TracingFairMutex = lock_api::Mutex; /// Mutex guard for [`TracingFairMutex`]. pub type TracingFairMutexGuard<'a, T> = lock_api::MutexGuard<'a, TracingRawFairMutex, T>; +/// RAII guard for `TracingFairMutexGuard::map`. +pub type TracingMappedFairMutexGuard<'a, T> = + lock_api::MappedMutexGuard<'a, TracingRawFairMutex, T>; /// Debug-only dependency tracking fair mutex. /// /// If debug assertions are enabled this resolves to [`TracingFairMutex`] and to @@ -34,11 +37,15 @@ pub type TracingFairMutexGuard<'a, T> = lock_api::MutexGuard<'a, TracingRawFairM pub type DebugFairMutex = lock_api::Mutex; /// Mutex guard for [`DebugFairMutex`]. pub type DebugFairMutexGuard<'a, T> = lock_api::MutexGuard<'a, DebugRawFairMutex, T>; +/// RAII guard for `DebugFairMutexGuard::map`. +pub type DebugMappedFairMutexGuard<'a, T> = lock_api::MappedMutexGuard<'a, DebugRawFairMutex, T>; /// Dependency tracking mutex. See: [`parking_lot::Mutex`]. pub type TracingMutex = lock_api::Mutex; /// Mutex guard for [`TracingMutex`]. pub type TracingMutexGuard<'a, T> = lock_api::MutexGuard<'a, TracingRawMutex, T>; +/// RAII guard for `TracingMutexGuard::map`. +pub type TracingMappedMutexGuard<'a, T> = lock_api::MappedMutexGuard<'a, TracingRawMutex, T>; /// Debug-only dependency tracking mutex. /// /// If debug assertions are enabled this resolves to [`TracingMutex`] and to [`parking_lot::Mutex`] @@ -46,6 +53,8 @@ pub type TracingMutexGuard<'a, T> = lock_api::MutexGuard<'a, TracingRawMutex, T> pub type DebugMutex = lock_api::Mutex; /// Mutex guard for [`DebugMutex`]. pub type DebugMutexGuard<'a, T> = lock_api::MutexGuard<'a, DebugRawMutex, T>; +/// RAII guard for `TracingMutexGuard::map`. +pub type DebugMappedMutexGuard<'a, T> = lock_api::MappedMutexGuard<'a, DebugRawMutex, T>; /// Dependency tracking reentrant mutex. See: [`parking_lot::ReentrantMutex`]. /// @@ -61,6 +70,9 @@ pub type TracingReentrantMutexGuard<'a, T> = lock_api::ReentrantMutexGuard< parking_lot::RawThreadId, T, >; +/// RAII guard for `TracingReentrantMutexGuard::map`. +pub type TracingMappedReentrantMutexGuard<'a, T> = + lock_api::MappedReentrantMutexGuard<'a, TracingRawMutex, parking_lot::RawThreadId, T>; /// Debug-only dependency tracking reentrant mutex. /// @@ -71,6 +83,9 @@ pub type DebugReentrantMutex = /// Mutex guard for [`DebugReentrantMutex`]. pub type DebugReentrantMutexGuard<'a, T> = lock_api::ReentrantMutexGuard<'a, DebugRawMutex, parking_lot::RawThreadId, T>; +/// RAII guard for `DebugReentrantMutexGuard::map`. +pub type DebugMappedReentrantMutexGuard<'a, T> = + lock_api::MappedReentrantMutexGuard<'a, DebugRawMutex, parking_lot::RawThreadId, T>; /// Dependency tracking RwLock. See: [`parking_lot::RwLock`]. pub type TracingRwLock = lock_api::RwLock; @@ -78,6 +93,12 @@ pub type TracingRwLock = lock_api::RwLock; pub type TracingRwLockReadGuard<'a, T> = lock_api::RwLockReadGuard<'a, TracingRawRwLock, T>; /// Write guard for [`TracingRwLock`]. pub type TracingRwLockWriteGuard<'a, T> = lock_api::RwLockWriteGuard<'a, TracingRawRwLock, T>; +/// RAII guard for `TracingRwLockReadGuard::map`. +pub type TracingMappedRwLockReadGuard<'a, T> = + lock_api::MappedRwLockReadGuard<'a, TracingRawRwLock, T>; +/// RAII guard for `TracingRwLockWriteGuard::map`. +pub type TracingMappedRwLockWriteGuard<'a, T> = + lock_api::MappedRwLockWriteGuard<'a, TracingRawRwLock, T>; /// Debug-only dependency tracking RwLock. /// @@ -88,6 +109,11 @@ pub type DebugRwLock = lock_api::RwLock; pub type DebugRwLockReadGuard<'a, T> = lock_api::RwLockReadGuard<'a, DebugRawRwLock, T>; /// Write guard for [`TracingRwLock`]. pub type DebugRwLockWriteGuard<'a, T> = lock_api::RwLockWriteGuard<'a, DebugRawRwLock, T>; +/// RAII guard for `DebugRwLockReadGuard::map`. +pub type DebugMappedRwLockReadGuard<'a, T> = lock_api::MappedRwLockReadGuard<'a, DebugRawRwLock, T>; +/// RAII guard for `DebugRwLockWriteGuard::map`. +pub type DebugMappedRwLockWriteGuard<'a, T> = + lock_api::MappedRwLockWriteGuard<'a, DebugRawRwLock, T>; /// A dependency-tracking wrapper for [`parking_lot::Once`]. #[derive(Debug, Default)]