From 70cdd62337513b91c2bba7d68138379c5e84edd0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 19 May 2025 08:19:38 -0700 Subject: [PATCH] work --- rust/pspp/src/dictionary.rs | 14 ++++++++++---- rust/pspp/src/sys/raw.rs | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/rust/pspp/src/dictionary.rs b/rust/pspp/src/dictionary.rs index d0e2080fd1..0a93e0c639 100644 --- a/rust/pspp/src/dictionary.rs +++ b/rust/pspp/src/dictionary.rs @@ -191,7 +191,10 @@ where } } -impl PartialEq for Value { +impl PartialEq for Value +where + S: PartialEq, +{ fn eq(&self, other: &Self) -> bool { match (self, other) { (Self::Number(Some(l0)), Self::Number(Some(r0))) => { @@ -204,7 +207,7 @@ impl PartialEq for Value { } } -impl Eq for Value {} +impl Eq for Value where S: Eq {} impl PartialOrd for Value { fn partial_cmp(&self, other: &Self) -> Option { @@ -228,7 +231,10 @@ impl Ord for Value { } } -impl Hash for Value { +impl Hash for Value +where + S: Hash, +{ fn hash(&self, state: &mut H) { match self { Value::Number(number) => number.map(OrderedFloat).hash(state), @@ -663,7 +669,7 @@ pub struct Variable { /// Value labels, to associate a number (or a string) with a more meaningful /// description, e.g. 1 -> Apple, 2 -> Banana, ... - pub value_labels: HashMap, + pub value_labels: HashMap, String>, /// Variable label, an optional meaningful description for the variable /// itself. diff --git a/rust/pspp/src/sys/raw.rs b/rust/pspp/src/sys/raw.rs index 18daf2cef7..5fb598954f 100644 --- a/rust/pspp/src/sys/raw.rs +++ b/rust/pspp/src/sys/raw.rs @@ -1558,7 +1558,7 @@ impl Debug for RawStrArray { /// have the same contents. This is an important optimization for hashing: /// otherwise, strings could only be hashed if they were converted to a common /// encoding (probably UTF-8), which would be expensive. -#[derive(Clone)] +#[derive(Clone, Eq, Hash)] pub struct EncodedString { /// Raw contents. bytes: RawString, -- 2.30.2