pub trait RequestExt {
// Required methods
fn tag(&self) -> Option<&Tag>;
fn depth(&self) -> Depth;
fn attempt(&self) -> Attempt;
fn identity(&self) -> Option<&Identity>;
}Expand description
Reads crawl metadata from a Request.
A request gets its Tag, Depth and Attempt from the seed it is
made from, in Seed::into_request. A request built any other way has
no tag, the root depth and the first attempt; to give one metadata, e.g.
to test a handler, build it from a seed:
use spire_core::frontier::seed::Seed;
use spire_core::http::RequestExt;
use spire_core::crawler::Tag;
let request = Seed::get("https://example.com/")?.with_tag("page").into_request();
assert_eq!(request.tag(), Some(&Tag::from("page")));Required Methods§
Sourcefn depth(&self) -> Depth
fn depth(&self) -> Depth
Returns the depth, defaulting to Depth::ROOT.
Sourcefn attempt(&self) -> Attempt
fn attempt(&self) -> Attempt
Returns the attempt, defaulting to Attempt::FIRST.
Sourcefn identity(&self) -> Option<&Identity>
fn identity(&self) -> Option<&Identity>
Returns the identity the request goes out as, if the crawl has identities.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".