Struct tree_sitter_md::MarkdownParser
source · pub struct MarkdownParser { /* private fields */ }
Expand description
A parser that produces MarkdownTree
s.
This is a convenience wrapper around LANGUAGE
and INLINE_LANGUAGE
.
Implementations§
source§impl MarkdownParser
impl MarkdownParser
sourcepub fn parse_with<T: AsRef<[u8]>, F: FnMut(usize, Point) -> T>(
&mut self,
callback: &mut F,
old_tree: Option<&MarkdownTree>,
) -> Option<MarkdownTree>
pub fn parse_with<T: AsRef<[u8]>, F: FnMut(usize, Point) -> T>( &mut self, callback: &mut F, old_tree: Option<&MarkdownTree>, ) -> Option<MarkdownTree>
Parse a slice of UTF8 text.
§Arguments:
text
The UTF8-encoded text to parse.old_tree
A previous syntax tree parsed from the same document. If the text of the document has changed sinceold_tree
was created, then you must editold_tree
to match the new text using MarkdownTree::edit.
Returns a MarkdownTree if parsing succeeded, or None
if:
- The timeout set with tree_sitter::Parser::set_timeout_micros expired
- The cancellation flag set with tree_sitter::Parser::set_cancellation_flag was flipped
sourcepub fn parse(
&mut self,
text: &[u8],
old_tree: Option<&MarkdownTree>,
) -> Option<MarkdownTree>
pub fn parse( &mut self, text: &[u8], old_tree: Option<&MarkdownTree>, ) -> Option<MarkdownTree>
Parse a slice of UTF8 text.
§Arguments:
text
The UTF8-encoded text to parse.old_tree
A previous syntax tree parsed from the same document. If the text of the document has changed sinceold_tree
was created, then you must editold_tree
to match the new text using MarkdownTree::edit.
Returns a MarkdownTree if parsing succeeded, or None
if:
- The timeout set with tree_sitter::Parser::set_timeout_micros expired
- The cancellation flag set with tree_sitter::Parser::set_cancellation_flag was flipped
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MarkdownParser
impl RefUnwindSafe for MarkdownParser
impl Send for MarkdownParser
impl Sync for MarkdownParser
impl Unpin for MarkdownParser
impl UnwindSafe for MarkdownParser
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more