Don't expose pageiter module, and add some docs to PageIter

master
Paul Woolcock 6 years ago
parent 0e8eb4e568
commit 6d67e403bc
  1. 2
      src/entities/mod.rs
  2. 11
      src/entities/pageiter.rs

@ -6,7 +6,7 @@ pub mod instance;
pub mod list; pub mod list;
pub mod mention; pub mod mention;
pub mod notification; pub mod notification;
pub mod pageiter; mod pageiter;
pub mod relationship; pub mod relationship;
pub mod report; pub mod report;
pub mod search_result; pub mod search_result;

@ -29,6 +29,17 @@ into_pageiter!(Notification);
into_pageiter!(Report); into_pageiter!(Report);
into_pageiter!(Relationship); into_pageiter!(Relationship);
/// Abstracts away the `next_page` logic into a single stream of items
///
/// ```ignore
/// # extern crate mammut
/// # use mammut::Mastodon;
/// let client = Mastodon::from_data(data);
/// let statuses = client.statuses("user-id", None);
/// for status in statuses.into_iter() {
/// // do something with `status`
/// }
/// ```
pub struct PageIter<'a, T: Clone + for<'de> Deserialize<'de>> { pub struct PageIter<'a, T: Clone + for<'de> Deserialize<'de>> {
page: Page<'a, T>, page: Page<'a, T>,
buffer: Vec<T>, buffer: Vec<T>,

Loading…
Cancel
Save