mastodon-async/entities/src/list.rs

26 lines
531 B
Rust
Raw Normal View History

2022-12-07 20:58:28 +00:00
use serde::{Deserialize, Serialize};
2022-11-27 14:44:43 +00:00
/// Used for ser/de of list resources
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
2022-11-27 14:44:43 +00:00
pub struct List {
2023-01-09 13:25:10 +00:00
id: ListId,
2022-11-27 14:44:43 +00:00
title: String,
}
2023-01-09 13:25:10 +00:00
/// Wrapper type for a list ID string
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(transparent)]
pub struct ListId(String);
impl AsRef<str> for ListId {
fn as_ref(&self) -> &str {
&self.0
}
}
impl ListId {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
}