From 547d994d13a2cc9c27f19fcdda396d6972ed810a Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Mon, 9 Jan 2023 07:44:54 -0500 Subject: [PATCH] Add ID type for account --- entities/src/account.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/entities/src/account.rs b/entities/src/account.rs index 2afd9b3..f8d0d8c 100644 --- a/entities/src/account.rs +++ b/entities/src/account.rs @@ -30,7 +30,7 @@ pub struct Account { /// URL to the header static image (gif). pub header_static: String, /// The ID of the account. - pub id: String, + pub id: AccountId, /// Boolean for when the account cannot be followed without waiting for /// approval first. pub locked: bool, @@ -54,6 +54,17 @@ pub struct Account { pub bot: Option, } +/// Wrapper type for a account ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct AccountId(String); + +impl AsRef for AccountId { + fn as_ref(&self) -> &str { + &self.0 + } +} + /// A single name: value pair from a user's profile #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct MetadataField {