Skip to content

Commit

Permalink
implement equal operator for Value
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianMoesl committed May 6, 2022
1 parent 207ed3e commit f344f91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ pub enum Value {
Bool(bool),
}

impl PartialEq for Value {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Value::Timestamp(lhs), Value::Timestamp(rhs)) => lhs == rhs,
(Value::Duration(lhs), Value::Duration(rhs)) => lhs == rhs,
(Value::String(lhs), Value::String(rhs)) => lhs == rhs,
(Value::Float(lhs), Value::Float(rhs)) => lhs == rhs,
(Value::Integer(lhs), Value::Integer(rhs)) => lhs == rhs,
(Value::Bool(lhs), Value::Bool(rhs)) => lhs == rhs,
_ => false,
}
}
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Benchmark {
pub data: HashMap<String, Value>,
Expand Down

0 comments on commit f344f91

Please sign in to comment.