diff options
Diffstat (limited to 'crates/vfs/src')
-rw-r--r-- | crates/vfs/src/vfs_path.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/crates/vfs/src/vfs_path.rs b/crates/vfs/src/vfs_path.rs index 0a8a86c62..940f91d0e 100644 --- a/crates/vfs/src/vfs_path.rs +++ b/crates/vfs/src/vfs_path.rs | |||
@@ -5,7 +5,7 @@ use paths::{AbsPath, AbsPathBuf}; | |||
5 | 5 | ||
6 | /// Long-term, we want to support files which do not reside in the file-system, | 6 | /// Long-term, we want to support files which do not reside in the file-system, |
7 | /// so we treat VfsPaths as opaque identifiers. | 7 | /// so we treat VfsPaths as opaque identifiers. |
8 | #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] | 8 | #[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] |
9 | pub struct VfsPath(VfsPathRepr); | 9 | pub struct VfsPath(VfsPathRepr); |
10 | 10 | ||
11 | impl VfsPath { | 11 | impl VfsPath { |
@@ -50,7 +50,7 @@ impl VfsPath { | |||
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] | 53 | #[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] |
54 | enum VfsPathRepr { | 54 | enum VfsPathRepr { |
55 | PathBuf(AbsPathBuf), | 55 | PathBuf(AbsPathBuf), |
56 | VirtualPath(VirtualPath), | 56 | VirtualPath(VirtualPath), |
@@ -71,6 +71,21 @@ impl fmt::Display for VfsPath { | |||
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | impl fmt::Debug for VfsPath { | ||
75 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
76 | fmt::Debug::fmt(&self.0, f) | ||
77 | } | ||
78 | } | ||
79 | |||
80 | impl fmt::Debug for VfsPathRepr { | ||
81 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
82 | match &self { | ||
83 | VfsPathRepr::PathBuf(it) => fmt::Debug::fmt(&it.display(), f), | ||
84 | VfsPathRepr::VirtualPath(VirtualPath(it)) => fmt::Debug::fmt(&it, f), | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | |||
74 | #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] | 89 | #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] |
75 | struct VirtualPath(String); | 90 | struct VirtualPath(String); |
76 | 91 | ||