mastodon-async/entities/src/report.rs

42 lines
1.1 KiB
Rust
Raw Normal View History

2022-11-27 14:44:43 +00:00
//! module containing information about a finished report of a user.
2022-12-07 20:58:28 +00:00
use serde::{Deserialize, Serialize};
2022-11-27 14:44:43 +00:00
/// A struct containing info about a report.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
2022-11-27 14:44:43 +00:00
pub struct Report {
/// The ID of the report.
2023-01-09 12:54:07 +00:00
pub id: ReportId,
2022-11-27 14:44:43 +00:00
/// The action taken in response to the report.
pub action_taken: String,
}
2023-01-09 12:54:07 +00:00
/// Wrapper type for a report ID string
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(transparent)]
pub struct ReportId(String);
impl AsRef<str> for ReportId {
fn as_ref(&self) -> &str {
&self.0
}
}
2023-01-09 13:26:13 +00:00
impl ReportId {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
}
2023-01-09 13:39:42 +00:00
static_assertions::assert_not_impl_any!(
ReportId: PartialEq<crate::account::AccountId>,
PartialEq<crate::attachment::AttachmentId>,
PartialEq<crate::filter::FilterId>,
PartialEq<crate::push::SubscriptionId>,
PartialEq<crate::mention::MentionId>,
PartialEq<crate::notification::NotificationId>,
PartialEq<crate::relationship::RelationshipId>,
PartialEq<crate::list::ListId>,
PartialEq<crate::status::StatusId>,
);