#[repr(transparent)]pub struct Parser<Root: Node<'static>>(pub Parser, _);Expand description
A stateful object that this is used to produce a tree based on some source code.
Tuple Fields§
§0: ParserImplementations§
Source§impl<Root: Node<'static>> Parser<Root>
impl<Root: Node<'static>> Parser<Root>
Sourcepub fn wrap(parser: Parser) -> Self
pub fn wrap(parser: Parser) -> Self
Convert a tree-sitter parser into a typed parser by specifying the correct root node type.
This will succeed even if Root is not the language’s root node, because
Tree::root_node checks that the root node is the correct type.
Sourcepub fn new(language: &Language) -> Result<Self, LanguageError>
pub fn new(language: &Language) -> Result<Self, LanguageError>
Create a new parser for the given language. See tree_sitter::Parser::set_language
Sourcepub fn set_included_ranges(
&mut self,
ranges: &[Range],
) -> Result<(), IncludedRangesError>
pub fn set_included_ranges( &mut self, ranges: &[Range], ) -> Result<(), IncludedRangesError>
Set the ranges of text the parser should include when parsing. See
tree_sitter::Parser::set_included_ranges
Auto Trait Implementations§
impl<Root> Freeze for Parser<Root>
impl<Root> RefUnwindSafe for Parser<Root>where
Root: RefUnwindSafe,
impl<Root> Send for Parser<Root>where
Root: Send,
impl<Root> Sync for Parser<Root>where
Root: Sync,
impl<Root> Unpin for Parser<Root>where
Root: Unpin,
impl<Root> UnwindSafe for Parser<Root>where
Root: UnwindSafe,
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