|
|
@ -12,16 +12,16 @@ use serde::Deserialize; |
|
|
|
/// // do something with `status`
|
|
|
|
/// // do something with `status`
|
|
|
|
/// }
|
|
|
|
/// }
|
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
pub struct PageIter<'a, T: Clone + for<'de> Deserialize<'de>> { |
|
|
|
pub struct ItemsIter<'a, T: Clone + for<'de> Deserialize<'de>> { |
|
|
|
page: Page<'a, T>, |
|
|
|
page: Page<'a, T>, |
|
|
|
buffer: Vec<T>, |
|
|
|
buffer: Vec<T>, |
|
|
|
cur_idx: usize, |
|
|
|
cur_idx: usize, |
|
|
|
use_initial: bool, |
|
|
|
use_initial: bool, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl<'a, T: Clone + for<'de> Deserialize<'de>> PageIter<'a, T> { |
|
|
|
impl<'a, T: Clone + for<'de> Deserialize<'de>> ItemsIter<'a, T> { |
|
|
|
pub(crate) fn new(page: Page<'a, T>) -> PageIter<'a, T> { |
|
|
|
pub(crate) fn new(page: Page<'a, T>) -> ItemsIter<'a, T> { |
|
|
|
PageIter { |
|
|
|
ItemsIter { |
|
|
|
page: page, |
|
|
|
page: page, |
|
|
|
buffer: vec![], |
|
|
|
buffer: vec![], |
|
|
|
cur_idx: 0, |
|
|
|
cur_idx: 0, |
|
|
@ -50,7 +50,7 @@ impl<'a, T: Clone + for<'de> Deserialize<'de>> PageIter<'a, T> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl<'a, T: Clone+ for<'de> Deserialize<'de>> Iterator for PageIter<'a, T> { |
|
|
|
impl<'a, T: Clone+ for<'de> Deserialize<'de>> Iterator for ItemsIter<'a, T> { |
|
|
|
type Item = T; |
|
|
|
type Item = T; |
|
|
|
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Self::Item> { |
|
|
|
fn next(&mut self) -> Option<Self::Item> { |