diff options
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/value/string.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs index f9178ca7f4bb..3816e89cd1b1 100644 --- a/tvix/eval/src/value/string.rs +++ b/tvix/eval/src/value/string.rs @@ -4,7 +4,7 @@ use std::{borrow::Cow, fmt::Display}; /// This module implements Nix language strings and their different /// backing implementations. -#[derive(Clone, Debug, Eq, Ord)] +#[derive(Clone, Debug)] pub enum NixString { Static(&'static str), Heap(String), @@ -16,12 +16,20 @@ impl PartialEq for NixString { } } +impl Eq for NixString {} + impl PartialOrd for NixString { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { self.as_str().partial_cmp(other.as_str()) } } +impl Ord for NixString { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_str().cmp(other.as_str()) + } +} + impl From<&'static str> for NixString { fn from(s: &'static str) -> Self { NixString::Static(s) |