From 4dd0bf61c9789e19eeb3ac043f217d661070f0da Mon Sep 17 00:00:00 2001 From: Kim Altintop Date: Fri, 28 Oct 2022 11:58:21 +0200 Subject: [PATCH] PartialEq, Eq for Signature Necessarily hand-derived structural equality, as the raw binding stores pointers for the string fields. --- src/signature.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/signature.rs b/src/signature.rs index 32cfa2c812..83fbbf5935 100644 --- a/src/signature.rs +++ b/src/signature.rs @@ -158,6 +158,16 @@ impl<'a> fmt::Display for Signature<'a> { } } +impl PartialEq for Signature<'_> { + fn eq(&self, other: &Self) -> bool { + self.when() == other.when() + && self.email_bytes() == other.email_bytes() + && self.name_bytes() == other.name_bytes() + } +} + +impl Eq for Signature<'_> {} + #[cfg(test)] mod tests { use crate::{Signature, Time};