#[non_exhaustive]pub struct HtmlContext {
pub request: Arc<Request>,
pub response: Arc<HttpResponse>,
pub html: Arc<SynchronizedHtml>,
pub session: Option<Arc<Session>>,
pub proxy_info: Option<ProxyInfo>,
pub enqueue: EnqueueLinker,
pub storage: StorageHandle,
pub crawler: CrawlerHandle,
/* private fields */
}Expand description
Per-request context produced by HtmlKind.
This intentionally differs from the design sketch in INTERFACE §4.2 in two ways. The response is an
Arc<HttpResponse> because CrawlerKind::Context must be a cheap aliasing clone and the
engine clones a context for each attempt. The HTML field uses SynchronizedHtml because
scraper::Html is not Sync, as detailed on that type. The proposed log: Log field is
omitted because no Log type exists yet, logging is not scheduled by the roadmap, and Phase
2’s BasicContext likewise omits it; use tracing macros in the meantime.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.request: Arc<Request>Crawl request that produced this context.
response: Arc<HttpResponse>Final buffered response, shared cheaply across context clones.
html: Arc<SynchronizedHtml>Parsed HTML document, shared cheaply and synchronized across context clones.
The owned query helpers cover common operations, while SynchronizedHtml::lock exposes
the complete scraper::Html API behind a dereferencing guard.
session: Option<Arc<Session>>Session used for this attempt, if sessions are enabled.
proxy_info: Option<ProxyInfo>Proxy selected for this attempt.
enqueue: EnqueueLinkerURL enqueue helper linked to the running crawler.
storage: StorageHandleOpen default storage resources. For example, ctx.storage.dataset().push(&item) works
when millipede_core::storage::DatasetExt is in scope.
crawler: CrawlerHandleWeak handle back to the running crawler.
Trait Implementations§
Source§impl Clone for HtmlContext
impl Clone for HtmlContext
Source§fn clone(&self) -> HtmlContext
fn clone(&self) -> HtmlContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more