##// END OF EJS Templates
rust-hg-path: implement `Display` for `HgPath` and `HgPathBuf`...
Raphaël Gomès -
r44279:c27e688f default
parent child Browse files
Show More
@@ -7,6 +7,7 b''
7
7
8 use std::borrow::Borrow;
8 use std::borrow::Borrow;
9 use std::ffi::{OsStr, OsString};
9 use std::ffi::{OsStr, OsString};
10 use std::fmt;
10 use std::ops::Deref;
11 use std::ops::Deref;
11 use std::path::{Path, PathBuf};
12 use std::path::{Path, PathBuf};
12
13
@@ -162,6 +163,12 b' impl HgPath {'
162 }
163 }
163 }
164 }
164
165
166 impl fmt::Display for HgPath {
167 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
168 write!(f, "{}", String::from_utf8_lossy(&self.inner))
169 }
170 }
171
165 #[derive(Eq, Ord, Clone, PartialEq, PartialOrd, Debug, Hash)]
172 #[derive(Eq, Ord, Clone, PartialEq, PartialOrd, Debug, Hash)]
166 pub struct HgPathBuf {
173 pub struct HgPathBuf {
167 inner: Vec<u8>,
174 inner: Vec<u8>,
@@ -185,6 +192,12 b' impl HgPathBuf {'
185 }
192 }
186 }
193 }
187
194
195 impl fmt::Display for HgPathBuf {
196 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
197 write!(f, "{}", String::from_utf8_lossy(&self.inner))
198 }
199 }
200
188 impl Deref for HgPathBuf {
201 impl Deref for HgPathBuf {
189 type Target = HgPath;
202 type Target = HgPath;
190
203
General Comments 0
You need to be logged in to leave comments. Login now