Skip to main content

ExtractionContext

Struct ExtractionContext 

Source
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: u64

First 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.

Auto Trait Implementations§

§

impl<'a> Freeze for ExtractionContext<'a>

§

impl<'a> RefUnwindSafe for ExtractionContext<'a>

§

impl<'a> Send for ExtractionContext<'a>

§

impl<'a> Sync for ExtractionContext<'a>

§

impl<'a> Unpin for ExtractionContext<'a>

§

impl<'a> UnsafeUnpin for ExtractionContext<'a>

§

impl<'a> UnwindSafe for ExtractionContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.