Skip to main content

ProcessorInput

Struct ProcessorInput 

Source
pub struct ProcessorInput<'a> {
    pub options: &'a MultiSourceOptions,
    pub meta: &'a Value,
    pub parser: &'a Arc<Tabnas>,
    pub depth: usize,
}
Expand description

What a Processor is given.

The canonical TypeScript hands a processor the whole parse Context, of which processors read only ctx.meta, plus the instance. Narrowing it keeps a processor callable, and therefore testable, outside a parse.

Fields§

§options: &'a MultiSourceOptions

The plugin options in force for this parse.

§meta: &'a Value

The metadata for this load. multisource.path names the source being processed, which is how a relative reference inside it resolves against its own directory.

§parser: &'a Arc<Tabnas>

The parser the document is being read by, for a processor that re-parses its source.

§depth: usize

How many sources enclose this one. Zero for a reference in the document the caller handed to parse.

Implementations§

Source§

impl ProcessorInput<'_>

Source

pub fn parse_source(&self, src: &str) -> Result<Value, TabnasError>

Re-parse src as a nested source of this load.

Use this rather than calling the parser directly: it threads the metadata through, so a relative reference inside src resolves against this source’s own directory, and it keeps the chain off one stack. See parse_nested.

Trait Implementations§

Source§

impl<'a> Clone for ProcessorInput<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ProcessorInput<'a>

Source§

impl Debug for ProcessorInput<'_>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ProcessorInput<'a>

§

impl<'a> !UnwindSafe for ProcessorInput<'a>

§

impl<'a> Forget for ProcessorInput<'a>

§

impl<'a> Freeze for ProcessorInput<'a>

§

impl<'a> Move for ProcessorInput<'a>

§

impl<'a> Send for ProcessorInput<'a>
where &'a MultiSourceOptions: Send, &'a Value: Send, &'a Arc<Tabnas>: Send,

§

impl<'a> Sync for ProcessorInput<'a>

§

impl<'a> Unpin for ProcessorInput<'a>

§

impl<'a> UnsafeUnpin for ProcessorInput<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.