From 876ac3b985003511937a33c59098f4ab80084bcb Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Mon, 9 Jan 2023 08:25:24 -0500 Subject: [PATCH] Add Mention ID type --- entities/src/mention.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/entities/src/mention.rs b/entities/src/mention.rs index 88b109a..9a36dab 100644 --- a/entities/src/mention.rs +++ b/entities/src/mention.rs @@ -12,3 +12,20 @@ pub struct Mention { /// Account ID pub id: String, } + +/// Wrapper type for a mention ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct MentionId(String); + +impl AsRef for MentionId { + fn as_ref(&self) -> &str { + &self.0 + } +} + +impl MentionId { + pub fn new(value: impl Into) -> Self { + Self(value.into()) + } +}