pub struct Context { /* private fields */ }Expand description
A context for parsing operations.
Implementations§
Source§impl Context
impl Context
Sourcepub fn with_options(options: ContextOptions) -> Self
pub fn with_options(options: ContextOptions) -> Self
Creates a new Context with the given options.
Sourcepub fn add_link_reference(&mut self, label: impl AsRef<str>, node_ref: NodeRef)
pub fn add_link_reference(&mut self, label: impl AsRef<str>, node_ref: NodeRef)
Adds a link reference definition to the context.
Sourcepub fn link_reference(&self, label: &str) -> Option<NodeRef>
pub fn link_reference(&self, label: &str) -> Option<NodeRef>
Gets a link reference definition by label.
Sourcepub fn link_references(&self) -> Vec<NodeRef>
pub fn link_references(&self) -> Vec<NodeRef>
Gets all link reference definitions.
Sourcepub fn last_delimiter(&self) -> Option<ParseStackElemRef>
pub fn last_delimiter(&self) -> Option<ParseStackElemRef>
Gets the last opened delimiter reference.
Sourcepub fn insert<T: AnyValueSpec>(&mut self, key: ContextKey<T>, value: T::Item)
pub fn insert<T: AnyValueSpec>(&mut self, key: ContextKey<T>, value: T::Item)
Inserts a value into the context.
Sourcepub fn get<T: AnyValueSpec>(&self, key: ContextKey<T>) -> Option<&T::Item>
pub fn get<T: AnyValueSpec>(&self, key: ContextKey<T>) -> Option<&T::Item>
Gets a reference to a value from the context.
Sourcepub fn get_mut<T: AnyValueSpec>(
&mut self,
key: ContextKey<T>,
) -> Option<&mut T::Item>
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.
Sourcepub fn remove<T: AnyValueSpec>(&mut self, key: ContextKey<T>) -> Option<T::Item>
pub fn remove<T: AnyValueSpec>(&mut self, key: ContextKey<T>) -> Option<T::Item>
Removes a value from the context.
Sourcepub fn last_opened_block(&self) -> Option<NodeRef>
pub fn last_opened_block(&self) -> Option<NodeRef>
Returns the last opened block node reference.
Sourcepub fn block_offset(&self) -> Option<usize>
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.
Sourcepub fn block_indent(&self) -> Option<usize>
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.
Sourcepub fn is_in_link_label(&self) -> bool
pub fn is_in_link_label(&self) -> bool
Returns whether the parser is currently in a link label.