1use serde::Deserialize;
2
3#[derive(Debug, Clone, Deserialize)]
6#[serde(transparent)]
7pub struct ThreadList(pub Vec<ThreadListPage>);
8
9#[derive(Debug, Clone, Deserialize)]
10pub struct ThreadListPage {
11 pub page: u32,
12 pub threads: Vec<ThreadStub>,
13}
14
15#[derive(Debug, Clone, Deserialize)]
16pub struct ThreadStub {
17 pub no: u64, pub last_modified: i64, pub replies: u32,
20}
21
22impl ThreadList {
23 pub fn pages(&self) -> &[ThreadListPage] { &self.0 }
24
25 pub fn threads(&self) -> impl Iterator<Item = &ThreadStub> {
26 self.0.iter().flat_map(|p| p.threads.iter())
27 }
28}