diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-18 11:19:51 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-18 11:19:51 +0800 |
| commit | 2372495e1a0acb9ffead7651d8ed36a3bb98a15b (patch) | |
| tree | 5f330cdf1616b1e56a7b85b2b2530cdf1422ed54 /protocol/src/member.rs | |
| parent | 6f8906f06f3efd009275dc23f861f5aaba76ce72 (diff) | |
Add new protocol crate with basic types and operations
Diffstat (limited to 'protocol/src/member.rs')
| -rw-r--r-- | protocol/src/member.rs | 29 |
1 files changed, 29 insertions, 0 deletions
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<H: std::hash::Hasher>(&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) + } +} |
