[−][src]Struct mammut::page::Page
Fields
initial_items: Vec<T>
Initial set of items
Methods
impl<'a, T: for<'de> Deserialize<'de>> Page<'a, T>
[src]
pub fn new(mastodon: &'a Mastodon, response: Response) -> Result<Self>
[src]
pub fn next_page(&mut self) -> Result<Option<Vec<T>>>
[src]
pub fn prev_page(&mut self) -> Result<Option<Vec<T>>>
[src]
impl<'a, T: Clone + for<'de> Deserialize<'de>> Page<'a, T>
[src]
pub fn items_iter(self) -> impl Iterator<Item = T> + 'a where
T: 'a,
[src]
T: 'a,
Returns an iterator that provides a stream of T
s
This abstracts away the process of iterating over each item in a page, then making an http
call, then iterating over each item in the new page, etc. The iterator provides a stream of
T
s, calling self.next_page()
when necessary to get more of them, until there are no more
items.
Example
use mammut::{Mastodon, Data, StatusesRequest}; let mastodon = Mastodon::from_data(data); let req = StatusesRequest::new(); let resp = mastodon.statuses("some-id", req)?; for status in resp.items_iter() { // do something with status }
Auto Trait Implementations
impl<'a, T> Unpin for Page<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> Send for Page<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for Page<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> !UnwindSafe for Page<'a, T>
impl<'a, T> !RefUnwindSafe for Page<'a, T>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,