mangadex_api_schema_rust/v5/statistics/
comments.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use serde::Deserialize;
use url::Url;

#[derive(Deserialize, Clone, Debug, Copy)]
#[cfg_attr(feature = "non_exhaustive", non_exhaustive)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct Comments {
    pub thread_id: u32,
    pub replies_count: u32,
}

impl TryInto<Url> for Comments {
    type Error = url::ParseError;

    fn try_into(self) -> Result<Url, Self::Error> {
        Url::parse(format!("https://forums.mangadex.org/threads/{}", self.thread_id).as_str())
    }
}