From 158e5353bbaa85954a0a767857e265cf1e18d29d Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Mon, 24 May 2021 20:28:49 +0200 Subject: [PATCH] Add missing guard type aliases --- CHANGELOG.md | 8 +++++++- src/stdsync.rs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a2b731..1c30027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,19 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Added missing type aliases for the guards returned by `DebugMutex` and `DebugRwLock`. These new + type aliases function the same as the ones they belong to, resolving to either the tracing + versions when debug assertions are enabled or the standard one when they're not. + ## [0.1.1] - 2021-05-24 ### Changed - New data structure for interal dependency graph, resulting in quicker graph updates. ### Fixed -- Fixed an issue where internal graph ordering indices were exponential rather than sequential. +- Fixed an issue where internal graph ordering indices were exponential rather than sequential. This + caused the available IDs to run out way more quickly than intended. ## [0.1.0] - 2021-05-16 [YANKED] diff --git a/src/stdsync.rs b/src/stdsync.rs index 974b00d..14a575b 100644 --- a/src/stdsync.rs +++ b/src/stdsync.rs @@ -42,6 +42,12 @@ pub type DebugMutex = TracingMutex; #[cfg(not(debug_assertions))] pub type DebugMutex = Mutex; +/// Mutex guard for [`DebugMutex`]. +#[cfg(debug_assertions)] +pub type DebugMutexGuard<'a, T> = TracingMutexGuard<'a, T>; +#[cfg(not(debug_assertions))] +pub type DebugMutexGuard<'a, T> = MutexGuard<'a, T>; + /// Debug-only tracing `RwLock`. /// /// Type alias that resolves to [`TracingRwLock`] when debug assertions are enabled and to @@ -52,6 +58,18 @@ pub type DebugRwLock = TracingRwLock; #[cfg(not(debug_assertions))] pub type DebugRwLock = RwLock; +/// Read guard for [`DebugRwLock`]. +#[cfg(debug_assertions)] +pub type DebugReadGuard<'a, T> = TracingReadGuard<'a, T>; +#[cfg(not(debug_assertions))] +pub type DebugReadGuard<'a, T> = RwLockReadGuard<'a, T>; + +/// Write guard for [`DebugRwLock`]. +#[cfg(debug_assertions)] +pub type DebugWriteGuard<'a, T> = TracingWriteGuard<'a, T>; +#[cfg(not(debug_assertions))] +pub type DebugWriteGuard<'a, T> = RwLockWriteGuard<'a, T>; + /// Debug-only tracing `Once`. /// /// Type alias that resolves to [`TracingOnce`] when debug assertions are enabled and to