diff options
Diffstat (limited to 'tvix/eval/src/value/string.rs')
-rw-r--r-- | tvix/eval/src/value/string.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs index 1b4f349f1ac5..f9178ca7f4bb 100644 --- a/tvix/eval/src/value/string.rs +++ b/tvix/eval/src/value/string.rs @@ -1,9 +1,10 @@ +use std::hash::Hash; use std::{borrow::Cow, fmt::Display}; /// This module implements Nix language strings and their different /// backing implementations. -#[derive(Clone, Debug, Hash, Eq, Ord)] +#[derive(Clone, Debug, Eq, Ord)] pub enum NixString { Static(&'static str), Heap(String), @@ -33,6 +34,12 @@ impl From<String> for NixString { } } +impl Hash for NixString { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.as_str().hash(state) + } +} + impl NixString { pub const NAME: Self = NixString::Static("name"); pub const VALUE: Self = NixString::Static("value"); |