aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/base_db')
-rw-r--r--crates/base_db/src/input.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs
index eb3aac88d..02c7348ff 100644
--- a/crates/base_db/src/input.rs
+++ b/crates/base_db/src/input.rs
@@ -102,7 +102,29 @@ impl fmt::Display for CrateName {
102 102
103impl ops::Deref for CrateName { 103impl ops::Deref for CrateName {
104 type Target = str; 104 type Target = str;
105 fn deref(&self) -> &Self::Target { 105 fn deref(&self) -> &str {
106 &*self.0
107 }
108}
109
110#[derive(Debug, Clone, PartialEq, Eq, Hash)]
111pub struct CrateDisplayName(CrateName);
112
113impl From<CrateName> for CrateDisplayName {
114 fn from(inner: CrateName) -> CrateDisplayName {
115 CrateDisplayName(inner)
116 }
117}
118
119impl fmt::Display for CrateDisplayName {
120 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
121 write!(f, "{}", self.0)
122 }
123}
124
125impl ops::Deref for CrateDisplayName {
126 type Target = str;
127 fn deref(&self) -> &str {
106 &*self.0 128 &*self.0
107 } 129 }
108} 130}