aboutsummaryrefslogtreecommitdiff
path: root/crates/vfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/vfs/src')
-rw-r--r--crates/vfs/src/vfs_path.rs19
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)]
9pub struct VfsPath(VfsPathRepr); 9pub struct VfsPath(VfsPathRepr);
10 10
11impl VfsPath { 11impl 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)]
54enum VfsPathRepr { 54enum 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
74impl fmt::Debug for VfsPath {
75 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
76 fmt::Debug::fmt(&self.0, f)
77 }
78}
79
80impl 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)]
75struct VirtualPath(String); 90struct VirtualPath(String);
76 91