mastodon_async_entities/
report.rs

1//! module containing information about a finished report of a user.
2
3use std::fmt::Display;
4
5use serde::{Deserialize, Serialize};
6
7/// A struct containing info about a report.
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
9pub struct Report {
10    /// The ID of the report.
11    pub id: ReportId,
12    /// The action taken in response to the report.
13    pub action_taken: String,
14}
15
16/// Wrapper type for a report ID string
17#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
18#[serde(transparent)]
19pub struct ReportId(String);
20
21impl AsRef<str> for ReportId {
22    fn as_ref(&self) -> &str {
23        &self.0
24    }
25}
26
27impl ReportId {
28    pub fn new(value: impl Into<String>) -> Self {
29        Self(value.into())
30    }
31}
32
33impl Display for ReportId {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35        write!(f, "{}", self.0)
36    }
37}
38
39static_assertions::assert_not_impl_any!(
40    ReportId: PartialEq<crate::account::AccountId>,
41    PartialEq<crate::attachment::AttachmentId>,
42    PartialEq<crate::filter::FilterId>,
43    PartialEq<crate::push::SubscriptionId>,
44    PartialEq<crate::mention::MentionId>,
45    PartialEq<crate::notification::NotificationId>,
46    PartialEq<crate::relationship::RelationshipId>,
47    PartialEq<crate::list::ListId>,
48    PartialEq<crate::status::StatusId>,
49);