1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::params::Params;
use serde::{Deserialize, Serialize};
use std::str::FromStr;
#[derive(Debug, Serialize, Deserialize)]
pub struct Page {
pub limit: u64,
pub offset: Option<u64>,
pub next: Option<String>,
}
impl Page {
pub fn has_next(&self) -> bool {
match self.next {
None => false,
Some(_) => true,
}
}
pub fn get_next(self) -> Option<Params> {
match self.next {
None => None,
Some(s) => Some(Params::from_str(&s).unwrap()),
}
}
}