diff --git a/entities/src/account.rs b/entities/src/account.rs index f60aad5..1c3940b 100644 --- a/entities/src/account.rs +++ b/entities/src/account.rs @@ -4,7 +4,7 @@ use serde::{ de::{self, Deserializer, Unexpected}, Deserialize, Serialize, }; -use std::path::PathBuf; +use std::{fmt::Display, path::PathBuf}; use time::{serde::iso8601, OffsetDateTime}; /// A struct representing an Account. @@ -71,6 +71,12 @@ impl AccountId { } } +impl Display for AccountId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( AccountId: PartialEq, PartialEq, diff --git a/entities/src/attachment.rs b/entities/src/attachment.rs index 671441c..15fc2a4 100644 --- a/entities/src/attachment.rs +++ b/entities/src/attachment.rs @@ -1,5 +1,7 @@ //! Module containing everything related to media attachements. +use std::fmt::Display; + use serde::{Deserialize, Serialize}; /// A struct representing a media attachment. @@ -41,6 +43,12 @@ impl AttachmentId { } } +impl Display for AttachmentId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( AttachmentId: PartialEq, PartialEq, diff --git a/entities/src/filter.rs b/entities/src/filter.rs index b7cf727..02b138a 100644 --- a/entities/src/filter.rs +++ b/entities/src/filter.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + use serde::{de::Visitor, Deserialize, Deserializer, Serialize}; use time::{serde::iso8601, OffsetDateTime}; @@ -68,6 +70,12 @@ impl FilterId { } } +impl Display for FilterId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( FilterId: PartialEq, PartialEq, diff --git a/entities/src/mention.rs b/entities/src/mention.rs index 6b38b22..2c00c2e 100644 --- a/entities/src/mention.rs +++ b/entities/src/mention.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + use serde::{Deserialize, Serialize}; /// Represents a `mention` used in a status @@ -30,6 +32,12 @@ impl MentionId { } } +impl Display for MentionId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( Mention: PartialEq, PartialEq, diff --git a/entities/src/notification.rs b/entities/src/notification.rs index 8aff456..a7fd729 100644 --- a/entities/src/notification.rs +++ b/entities/src/notification.rs @@ -1,5 +1,7 @@ //! Module containing all info about notifications. +use std::fmt::Display; + use super::{account::Account, status::Status}; use serde::{Deserialize, Serialize}; use time::{serde::iso8601, OffsetDateTime}; @@ -39,6 +41,12 @@ impl NotificationId { } } +impl Display for NotificationId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( NotificationId: PartialEq, PartialEq, diff --git a/entities/src/push.rs b/entities/src/push.rs index a51ce94..af1d99e 100644 --- a/entities/src/push.rs +++ b/entities/src/push.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + use serde::{Deserialize, Serialize}; /// Represents the `alerts` key of the `Subscription` object @@ -43,6 +45,12 @@ impl SubscriptionId { } } +impl Display for SubscriptionId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( SubscriptionId: PartialEq, PartialEq, diff --git a/entities/src/relationship.rs b/entities/src/relationship.rs index 83cf063..4ccd3ee 100644 --- a/entities/src/relationship.rs +++ b/entities/src/relationship.rs @@ -1,6 +1,8 @@ //! module containing everything relating to a relationship with //! another account. +use std::fmt::Display; + use serde::{Deserialize, Serialize}; /// A struct containing information about a relationship with another account. @@ -48,6 +50,11 @@ impl RelationshipId { Self(value.into()) } } +impl Display for RelationshipId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} static_assertions::assert_not_impl_any!( RelationshipId: PartialEq, diff --git a/entities/src/report.rs b/entities/src/report.rs index d6450b4..4fa8c13 100644 --- a/entities/src/report.rs +++ b/entities/src/report.rs @@ -1,5 +1,7 @@ //! module containing information about a finished report of a user. +use std::fmt::Display; + use serde::{Deserialize, Serialize}; /// A struct containing info about a report. @@ -28,6 +30,12 @@ impl ReportId { } } +impl Display for ReportId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( ReportId: PartialEq, PartialEq, diff --git a/entities/src/status.rs b/entities/src/status.rs index b4133b0..e270598 100644 --- a/entities/src/status.rs +++ b/entities/src/status.rs @@ -1,5 +1,7 @@ //! Module containing all info relating to a status. +use std::fmt::Display; + use super::prelude::*; use crate::{card::Card, visibility::Visibility}; use serde::{Deserialize, Serialize}; @@ -82,6 +84,12 @@ impl StatusId { } } +impl Display for StatusId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + static_assertions::assert_not_impl_any!( StatusId: PartialEq, PartialEq,