diff options
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/value/string.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs index 47661e03add4..1937a35870d3 100644 --- a/tvix/eval/src/value/string.rs +++ b/tvix/eval/src/value/string.rs @@ -3,7 +3,7 @@ use std::fmt::Display; /// This module implements Nix language strings and their different /// backing implementations. -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Hash, Eq, Ord)] pub enum NixString { Static(&'static str), Heap(String), @@ -18,6 +18,18 @@ impl Display for NixString { } } +impl PartialEq for NixString { + fn eq(&self, other: &Self) -> bool { + self.as_str() == other.as_str() + } +} + +impl PartialOrd for NixString { + fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { + self.as_str().partial_cmp(other.as_str()) + } +} + impl From<&'static str> for NixString { fn from(s: &'static str) -> Self { NixString::Static(s) |