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

This commit is contained in:
Paul Woolcock
2018-08-21 15:56:01 -04:00
parent 0e8eb4e568
commit 6d67e403bc
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -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;
+11
View File
@@ -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>,