mastodon_async_entities/
list.rs

1use serde::{Deserialize, Serialize};
2
3/// Used for ser/de of list resources
4#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
5pub struct List {
6    id: ListId,
7    title: String,
8}
9
10/// Wrapper type for a list ID string
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
12#[serde(transparent)]
13pub struct ListId(String);
14
15impl AsRef<str> for ListId {
16    fn as_ref(&self) -> &str {
17        &self.0
18    }
19}
20
21impl ListId {
22    pub fn new(value: impl Into<String>) -> Self {
23        Self(value.into())
24    }
25}
26
27static_assertions::assert_not_impl_any!(
28    ListId: PartialEq<crate::account::AccountId>,
29    PartialEq<crate::attachment::AttachmentId>,
30    PartialEq<crate::filter::FilterId>,
31    PartialEq<crate::push::SubscriptionId>,
32    PartialEq<crate::mention::MentionId>,
33    PartialEq<crate::notification::NotificationId>,
34    PartialEq<crate::relationship::RelationshipId>,
35    PartialEq<crate::report::ReportId>,
36    PartialEq<crate::status::StatusId>,
37);