##// END OF EJS Templates
rust-hg-path: implement more readable custom Debug for HgPath{,Buf}...
Martin von Zweigbergk -
r44360:4b3c8df1 default
parent child Browse files
Show More
@@ -77,7 +77,7 b' impl From<HgPathError> for std::io::Erro'
77 77 // `#[repr(transparent)]`.
78 78 // Anyway, `Slice` representation and layout are considered implementation
79 79 // detail, are not documented and must not be relied upon.
80 #[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Hash)]
80 #[derive(Eq, Ord, PartialEq, PartialOrd, Hash)]
81 81 pub struct HgPath {
82 82 inner: [u8],
83 83 }
@@ -181,13 +181,19 b' impl HgPath {'
181 181 }
182 182 }
183 183
184 impl fmt::Debug for HgPath {
185 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
186 write!(f, "HgPath({:?})", String::from_utf8_lossy(&self.inner))
187 }
188 }
189
184 190 impl fmt::Display for HgPath {
185 191 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
186 192 write!(f, "{}", String::from_utf8_lossy(&self.inner))
187 193 }
188 194 }
189 195
190 #[derive(Eq, Ord, Clone, PartialEq, PartialOrd, Debug, Hash)]
196 #[derive(Eq, Ord, Clone, PartialEq, PartialOrd, Hash)]
191 197 pub struct HgPathBuf {
192 198 inner: Vec<u8>,
193 199 }
@@ -210,6 +216,12 b' impl HgPathBuf {'
210 216 }
211 217 }
212 218
219 impl fmt::Debug for HgPathBuf {
220 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
221 write!(f, "HgPathBuf({:?})", String::from_utf8_lossy(&self.inner))
222 }
223 }
224
213 225 impl fmt::Display for HgPathBuf {
214 226 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
215 227 write!(f, "{}", String::from_utf8_lossy(&self.inner))
General Comments 0
You need to be logged in to leave comments. Login now