Skip to content

Commit 9b99d3b

Browse files
cgwalterssunfishcode
authored andcommitted
impl Debug for DecInt
This is a best practice to be friendly to users who may want to add things to their own structs and want to simply `#[derive(Debug)]` and I'm assuming its omission was accidental.
1 parent b7cd6c2 commit 9b99d3b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/path/dec_int.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use crate::ffi::ZStr;
88
use crate::imp::fd::{AsFd, AsRawFd};
9+
#[cfg(feature = "std")]
10+
use core::fmt;
911
use core::fmt::Write;
1012
use itoa::{Buffer, Integer};
1113
#[cfg(feature = "std")]
@@ -123,3 +125,10 @@ impl AsRef<Path> for DecInt {
123125
Path::new(as_os_str)
124126
}
125127
}
128+
129+
#[cfg(feature = "std")]
130+
impl fmt::Debug for DecInt {
131+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
132+
self.as_str().fmt(fmt)
133+
}
134+
}

0 commit comments

Comments
 (0)