Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }
Expand description

A context for parsing operations.

Implementations§

Source§

impl Context

Source

pub fn new() -> Self

Creates a new Context with default options.

Source

pub fn with_options(options: ContextOptions) -> Self

Creates a new Context with the given options.

Adds a link reference definition to the context.

Gets a link reference definition by label.

Gets all link reference definitions.

Source

pub fn last_delimiter(&self) -> Option<ParseStackElemRef>

Gets the last opened delimiter reference.

Source

pub fn insert<T: AnyValueSpec>(&mut self, key: ContextKey<T>, value: T::Item)

Inserts a value into the context.

Source

pub fn get<T: AnyValueSpec>(&self, key: ContextKey<T>) -> Option<&T::Item>

Gets a reference to a value from the context.

Source

pub fn get_mut<T: AnyValueSpec>( &mut self, key: ContextKey<T>, ) -> Option<&mut T::Item>

Gets a mutable reference to a value from the context.

Source

pub fn remove<T: AnyValueSpec>(&mut self, key: ContextKey<T>) -> Option<T::Item>

Removes a value from the context.

Source

pub fn ids(&self) -> &NodeIds

Returns an ids.

Source

pub fn ids_mut(&mut self) -> &mut NodeIds

Returns a mutable ids.

Source

pub fn last_opened_block(&self) -> Option<NodeRef>

Returns the last opened block node reference.

Source

pub fn block_offset(&self) -> Option<usize>

Returns a first non-space character position on current line. This value is valid only for BlockParser::open. This returns None if current line is blank.

Source

pub fn block_indent(&self) -> Option<usize>

Returns an indent width on current line. This value is valid only for BlockParser::open. This returns None if current line is blank.

Returns whether the parser is currently in a link label.

Trait Implementations§

Source§

impl Default for Context

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.