|
|
@ -3,14 +3,25 @@ use serde::Deserialize; |
|
|
|
|
|
|
|
|
|
|
|
/// Abstracts away the `next_page` logic into a single stream of items
|
|
|
|
/// Abstracts away the `next_page` logic into a single stream of items
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// ```ignore
|
|
|
|
/// ```no_run
|
|
|
|
/// # extern crate mammut
|
|
|
|
/// # extern crate mammut;
|
|
|
|
/// # use mammut::Mastodon;
|
|
|
|
/// # use mammut::{Data, Mastodon};
|
|
|
|
|
|
|
|
/// # use std::error::Error;
|
|
|
|
|
|
|
|
/// # fn main() -> Result<(), Box<Error>> {
|
|
|
|
|
|
|
|
/// # let data = Data {
|
|
|
|
|
|
|
|
/// # base: "".into(),
|
|
|
|
|
|
|
|
/// # client_id: "".into(),
|
|
|
|
|
|
|
|
/// # client_secret: "".into(),
|
|
|
|
|
|
|
|
/// # redirect: "".into(),
|
|
|
|
|
|
|
|
/// # token: "".into(),
|
|
|
|
|
|
|
|
/// # };
|
|
|
|
/// let client = Mastodon::from_data(data);
|
|
|
|
/// let client = Mastodon::from_data(data);
|
|
|
|
/// let statuses = client.statuses("user-id", None);
|
|
|
|
/// let statuses = client.statuses("user-id", false, false)?;
|
|
|
|
/// for status in statuses.into_iter() {
|
|
|
|
/// for status in statuses.items_iter() {
|
|
|
|
/// // do something with `status`
|
|
|
|
/// // do something with `status`
|
|
|
|
/// }
|
|
|
|
/// }
|
|
|
|
|
|
|
|
/// # Ok(())
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
pub struct ItemsIter<'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>, |
|
|
|