From 2372495e1a0acb9ffead7651d8ed36a3bb98a15b Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 18 Mar 2026 11:19:51 +0800 Subject: Add new protocol crate with basic types and operations --- protocol/src/member.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 protocol/src/member.rs (limited to 'protocol/src/member.rs') diff --git a/protocol/src/member.rs b/protocol/src/member.rs new file mode 100644 index 0000000..a892118 --- /dev/null +++ b/protocol/src/member.rs @@ -0,0 +1,29 @@ +use crate::member::email::EMailAddress; +use serde::{Deserialize, Serialize}; + +pub mod email; +pub mod error; + +#[derive(Debug, Clone, Eq, Serialize, Deserialize)] +pub struct Member { + name: String, + mail: EMailAddress, +} + +impl PartialEq for Member { + fn eq(&self, other: &Self) -> bool { + self.mail == other.mail + } +} + +impl std::hash::Hash for Member { + fn hash(&self, state: &mut H) { + self.mail.hash(state); + } +} + +impl std::fmt::Display for Member { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.name) + } +} -- cgit