Skip to content

Commit 7e48944

Browse files
committed
Impl Pointer for VirtAddr and PhysAddr
1 parent 87f9cd6 commit 7e48944

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/addr.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ impl fmt::UpperHex for VirtAddr {
236236
}
237237
}
238238

239+
impl fmt::Pointer for VirtAddr {
240+
#[inline]
241+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
242+
fmt::Pointer::fmt(&(self.0 as *const ()), f)
243+
}
244+
}
245+
239246
impl Add<u64> for VirtAddr {
240247
type Output = Self;
241248
#[inline]
@@ -443,6 +450,13 @@ impl fmt::UpperHex for PhysAddr {
443450
}
444451
}
445452

453+
impl fmt::Pointer for PhysAddr {
454+
#[inline]
455+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
456+
fmt::Pointer::fmt(&(self.0 as *const ()), f)
457+
}
458+
}
459+
446460
impl Add<u64> for PhysAddr {
447461
type Output = Self;
448462
#[inline]

0 commit comments

Comments
 (0)