diff options
Diffstat (limited to 'src/eval/str.rs')
| -rw-r--r-- | src/eval/str.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/eval/str.rs b/src/eval/str.rs index 1a0e3e1f..a358cd9f 100644 --- a/src/eval/str.rs +++ b/src/eval/str.rs @@ -6,7 +6,7 @@ use crate::diag::StrResult; use crate::util::EcoString; /// A string value with inline storage and clone-on-write semantics. -#[derive(Default, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Default, Clone, Eq, PartialEq, Ord, PartialOrd)] pub struct Str(EcoString); impl Str { @@ -46,6 +46,20 @@ impl Str { } } +impl Deref for Str { + type Target = str; + + fn deref(&self) -> &str { + self.0.deref() + } +} + +impl Debug for Str { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + Debug::fmt(&self.0, f) + } +} + impl Display for Str { fn fmt(&self, f: &mut Formatter) -> fmt::Result { f.write_char('"')?; @@ -63,20 +77,6 @@ impl Display for Str { } } -impl Debug for Str { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - Debug::fmt(&self.0, f) - } -} - -impl Deref for Str { - type Target = str; - - fn deref(&self) -> &str { - self.0.deref() - } -} - impl Add for Str { type Output = Self; |
