mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Introduce CrateDisplayName
This commit is contained in:
parent
af4e75533f
commit
a85c4280bf
1 changed files with 23 additions and 1 deletions
|
@ -102,7 +102,29 @@ impl fmt::Display for CrateName {
|
|||
|
||||
impl ops::Deref for CrateName {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
fn deref(&self) -> &str {
|
||||
&*self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct CrateDisplayName(CrateName);
|
||||
|
||||
impl From<CrateName> for CrateDisplayName {
|
||||
fn from(inner: CrateName) -> CrateDisplayName {
|
||||
CrateDisplayName(inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for CrateDisplayName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::Deref for CrateDisplayName {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &str {
|
||||
&*self.0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue