pub struct Walk<'a> { /* private fields */ }Expand description
A walk through a collection’s items; see Fetcher::walk.
An item is as the collection gives it: an IRI, or an object embedded in
the page. An embedded object whose id is on another origin than the
collection is the collection’s server’s claim about it, not its owner’s,
and is fetched from its id before it is trusted.
Implementations§
Source§impl Walk<'_>
impl Walk<'_>
Sourcepub fn by_host(self) -> Self
pub fn by_host(self) -> Self
Take a page on the collection’s host as its own, whatever its scheme
and port, as Mastodon’s non_matching_uri_hosts? does, rather than
only a page on the collection’s origin. Either way, only an http or
https page is taken.
Sourcepub async fn next(&mut self) -> Result<Option<Value>, FetchError>
pub async fn next(&mut self) -> Result<Option<Value>, FetchError>
The next item, or None when the collection has no more, or a limit
has been reached.
§Errors
When a page cannot be fetched, is not a collection or a page of one,
or is on another origin than the collection: FetchError::Invalid
for those, and as Fetcher::lookup for a fetch.
Sourcepub async fn next_page(&mut self) -> Result<Option<Vec<Value>>, FetchError>
pub async fn next_page(&mut self) -> Result<Option<Vec<Value>>, FetchError>
The items of the next page, or None when the collection has no
more pages, or a limit has been reached. A collection with a first
page is not a page of its own unless it holds items too; one without
is its only page, even when empty. Items Walk::next has read and
not handed out come first, as a page of their own.
§Errors
As Walk::next.
Sourcepub fn pages_fetched(&self) -> usize
pub fn pages_fetched(&self) -> usize
The pages fetched so far, the collection itself included.
Sourcepub fn total(&self) -> Option<u64>
pub fn total(&self) -> Option<u64>
The items the collection says it holds, totalItems, once its first
document has been fetched; it may differ from what the walk finds.