mirror of
https://github.com/bertptrs/tracing-mutex.git
synced 2025-12-25 12:40:31 +01:00
Add missing fmt impls
This commit is contained in:
@@ -10,6 +10,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
- `std::sync` wrappers now no longer incorrectly require `T: Sized`
|
||||
|
||||
- Added missing `Display` and `Debug` implementations to `RwLock(Read|Write)Guard`.
|
||||
|
||||
## [0.3.1]
|
||||
|
||||
### Added
|
||||
|
||||
@@ -34,7 +34,6 @@ pub struct Mutex<T: ?Sized> {
|
||||
///
|
||||
/// Refer to the [crate-level][`crate`] documentation for the differences between this struct and
|
||||
/// the one it wraps.
|
||||
#[derive(Debug)]
|
||||
pub struct MutexGuard<'a, T: ?Sized> {
|
||||
inner: sync::MutexGuard<'a, T>,
|
||||
_mutex: BorrowedMutex<'a>,
|
||||
@@ -148,18 +147,28 @@ impl<T> From<T> for Mutex<T> {
|
||||
impl<T: ?Sized> Deref for MutexGuard<'_, T> {
|
||||
type Target = T;
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> DerefMut for MutexGuard<'_, T> {
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'_, T> {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.inner.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: fmt::Display + ?Sized> fmt::Display for MutexGuard<'_, T> {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.inner.fmt(f)
|
||||
}
|
||||
@@ -287,7 +296,6 @@ pub struct RwLock<T: ?Sized> {
|
||||
/// Hybrid wrapper for both [`std::sync::RwLockReadGuard`] and [`std::sync::RwLockWriteGuard`].
|
||||
///
|
||||
/// Please refer to [`RwLockReadGuard`] and [`RwLockWriteGuard`] for usable types.
|
||||
#[derive(Debug)]
|
||||
pub struct TracingRwLockGuard<'a, L> {
|
||||
inner: L,
|
||||
_mutex: BorrowedMutex<'a>,
|
||||
@@ -411,6 +419,7 @@ where
|
||||
{
|
||||
type Target = T;
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.inner.deref()
|
||||
}
|
||||
@@ -421,11 +430,32 @@ where
|
||||
T: ?Sized,
|
||||
L: Deref<Target = T> + DerefMut,
|
||||
{
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
self.inner.deref_mut()
|
||||
}
|
||||
}
|
||||
|
||||
impl<L> fmt::Debug for TracingRwLockGuard<'_, L>
|
||||
where
|
||||
L: fmt::Debug,
|
||||
{
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.inner.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<L> fmt::Display for TracingRwLockGuard<'_, L>
|
||||
where
|
||||
L: fmt::Display,
|
||||
{
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.inner.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper around [`std::sync::Once`].
|
||||
///
|
||||
/// Refer to the [crate-level][`crate`] documentaiton for the differences between this struct
|
||||
|
||||
Reference in New Issue
Block a user