pub struct ExtractionContext<'a> {
pub offset: u64,
pub length: Option<u64>,
pub params: Option<&'a VarMap>,
}Expand description
Region of a parent Content that a
ContentExtractor should look at, plus
optional analyzer-supplied parameters.
Passed to
ContentExtractor::create_session.
Copy the fields you need into the ExtractionSession;
the context is only valid for that call.
When the scanner invokes an extractor because the parent was
identified as that extractor’s type, the context covers the whole
object: offset = 0, length = Some(content.size()),
params = None. When an analyzer queued the pass with
Context::request_extract, the fields come from that request.
Fields§
§offset: u64First byte of the region within the parent content.
length: Option<u64>Size of the region in bytes, when known.
Some(n) asserts the region is n bytes. None means the
extractor determines the extent itself (parse until the format
ends, scan to EOF, …).
params: Option<&'a VarMap>Analyzer-supplied extras (password, codec, flags, …).
None when the request had no
.param() calls (including
type-specific extraction of the parent itself). Some borrows
the pooled map for the duration of create_session only —
copy values out if the session needs them later.