use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
#[serde(transparent)]
pub struct ThreadList(pub Vec<ThreadListPage>);
#[derive(Debug, Clone, Deserialize)]
pub struct ThreadListPage {
pub page: u32,
pub threads: Vec<ThreadStub>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct ThreadStub {
pub no: u64, pub last_modified: i64, pub replies: u32,
}
impl ThreadList {
pub fn pages(&self) -> &[ThreadListPage] { &self.0 }
pub fn threads(&self) -> impl Iterator<Item = &ThreadStub> {
self.0.iter().flat_map(|p| p.threads.iter())
}
}