Skip to main content

nominal_api/conjure/objects/datasource/pagination/api/
page_token.rs

1/// A token that can be used to retrieve the next page of results. This token is intentionally a string to
2/// allow paging based on a variety of different criteria.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Deserialize,
7    conjure_object::serde::Serialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash,
13    Default
14)]
15#[serde(crate = "conjure_object::serde", transparent)]
16pub struct PageToken(pub String);
17impl std::fmt::Display for PageToken {
18    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        std::fmt::Display::fmt(&self.0, fmt)
20    }
21}
22impl conjure_object::Plain for PageToken {
23    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24        conjure_object::Plain::fmt(&self.0, fmt)
25    }
26}
27impl conjure_object::FromPlain for PageToken {
28    type Err = <String as conjure_object::FromPlain>::Err;
29    #[inline]
30    fn from_plain(s: &str) -> Result<PageToken, Self::Err> {
31        conjure_object::FromPlain::from_plain(s).map(PageToken)
32    }
33}
34impl std::convert::From<String> for PageToken {
35    #[inline]
36    fn from(v: String) -> Self {
37        PageToken(std::convert::From::from(v))
38    }
39}
40impl std::ops::Deref for PageToken {
41    type Target = String;
42    #[inline]
43    fn deref(&self) -> &String {
44        &self.0
45    }
46}
47impl std::ops::DerefMut for PageToken {
48    #[inline]
49    fn deref_mut(&mut self) -> &mut String {
50        &mut self.0
51    }
52}
53impl std::convert::AsRef<String> for PageToken {
54    #[inline]
55    fn as_ref(&self) -> &String {
56        &self.0
57    }
58}