pub struct Queue { /* private fields */ }Expand description
A cloneable handle for adding seeds to a crawl’s Frontier.
Handlers get a queue bound to the request they handle, so
Queue::follow can resolve relative links and derive the depth of the
requests it queues.
Implementations§
Source§impl Queue
impl Queue
Sourcepub fn child_of<B>(&self, request: &Request<B>) -> Self
pub fn child_of<B>(&self, request: &Request<B>) -> Self
Returns a queue whose follow treats links as found
on request.
Sourcepub fn rebase(&self, uri: Uri)
pub fn rebase(&self, uri: Uri)
Resolves relative links against uri from now on, e.g. the URI a
response was served from after redirects. Clones share the base.
Sourcepub async fn follow(&self, link: impl Into<Link>) -> Result<Admission>
pub async fn follow(&self, link: impl Into<Link>) -> Result<Admission>
Adds a link found on the current request, one level deeper.
The followed request has the link’s tag, or else the seed’s. Tags are not inherited: an untagged link goes to the router’s path routes or fallback, so pagination tags its links explicitly.
The tag is not part of the Fingerprint:
with a deduplicating frontier, a URL already followed under one tag is
a Duplicate under any other.
Relative hrefs resolve against the page; fragments are dropped.
Links that are not http(s) URLs, such as mailto: or malformed
ones, are skipped with Admission::Unsupported. Outside a handler,
links must be absolute and keep their depth.
§Errors
Returns an error if the frontier fails.