Add Mention ID type

This commit is contained in:
D. Scott Boggs 2023-01-09 08:25:24 -05:00 committed by Scott Boggs
parent 6d8a9d6194
commit 876ac3b985
1 changed files with 17 additions and 0 deletions

View File

@ -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<str> for MentionId {
fn as_ref(&self) -> &str {
&self.0
}
}
impl MentionId {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
}