pub struct RustParser { /* private fields */ }Expand description
A wrapper around tree-sitter for parsing Rust source code.
Implementations§
Source§impl RustParser
impl RustParser
Sourcepub fn new() -> Result<Self, ParseError>
pub fn new() -> Result<Self, ParseError>
Sourcepub fn parse(&mut self, source: &str) -> Option<Tree>
pub fn parse(&mut self, source: &str) -> Option<Tree>
Parses the given source code into a syntax tree.
Sourcepub fn parse_file(&mut self, path: &Path) -> Result<(String, Tree), ParseError>
pub fn parse_file(&mut self, path: &Path) -> Result<(String, Tree), ParseError>
Sourcepub fn create_query(&self, query_str: &str) -> Result<Query, ParseError>
pub fn create_query(&self, query_str: &str) -> Result<Query, ParseError>
Creates a query for matching patterns in the syntax tree.
§Errors
Returns an error if the query is invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RustParser
impl RefUnwindSafe for RustParser
impl Send for RustParser
impl Sync for RustParser
impl Unpin for RustParser
impl UnsafeUnpin for RustParser
impl UnwindSafe for RustParser
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more