Skip to content

Commit 16dcea3

Browse files
committed
Print pointer instead of values in Debug impl
1 parent 24db296 commit 16dcea3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/volatile_ptr/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::{fmt, marker::PhantomData, ptr::NonNull};
22

3-
use crate::access::{ReadWrite, Readable};
3+
use crate::access::ReadWrite;
44

55
mod macros;
66
mod operations;
@@ -48,9 +48,11 @@ where
4848
impl<T, A> fmt::Debug for VolatilePtr<'_, T, A>
4949
where
5050
T: Copy + fmt::Debug + ?Sized,
51-
A: Readable,
5251
{
5352
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54-
f.debug_tuple("Volatile").field(&self.read()).finish()
53+
f.debug_struct("VolatilePtr")
54+
.field("pointer", &self.pointer)
55+
.field("access", &self.access)
56+
.finish()
5557
}
5658
}

src/volatile_ref.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
2-
access::{Access, Copyable, ReadOnly, ReadWrite, Readable, WriteOnly},
3-
volatile_ptr,
2+
access::{Access, Copyable, ReadOnly, ReadWrite, WriteOnly},
3+
volatile_ptr::VolatilePtr,
44
};
55
use core::{fmt, marker::PhantomData, ptr::NonNull};
66

@@ -173,11 +173,11 @@ unsafe impl<T, A> Sync for VolatileRef<'_, T, A> where T: Sync {}
173173
impl<T, A> fmt::Debug for VolatileRef<'_, T, A>
174174
where
175175
T: Copy + fmt::Debug + ?Sized,
176-
A: Readable,
177176
{
178177
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
179-
f.debug_tuple("Volatile")
180-
.field(&self.as_ptr().read())
178+
f.debug_struct("VolatileRef")
179+
.field("pointer", &self.pointer)
180+
.field("access", &self.access)
181181
.finish()
182182
}
183183
}

0 commit comments

Comments
 (0)