Improve diffing #54

Merged
schmelczer merged 2 commits from asch/myers into main 2026-03-14 11:59:41 +00:00
Showing only changes of commit 6759e6a6a6 - Show all commits

Implement hash

Andras Schmelczer 2026-03-14 11:50:54 +00:00

View file

@ -1,4 +1,7 @@
use std::fmt::Debug;
use std::{
fmt::Debug,
hash::{Hash, Hasher},
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
@ -78,3 +81,14 @@ where
self.normalized == other.normalized
}
}
/// Hashes based on the `normalized` field only, consistent with the
/// [`PartialEq`] implementation.
impl<T> Hash for Token<T>
where
T: PartialEq + Clone + Debug + Hash,
{
fn hash<H: Hasher>(&self, state: &mut H) {
self.normalized.hash(state);
}
}