pub struct ParseValidator { /* private fields */ }Expand description
Parse validator using tree-sitter.
Implementations§
Source§impl ParseValidator
impl ParseValidator
Sourcepub fn new() -> Result<Self, TreeSitterError>
pub fn new() -> Result<Self, TreeSitterError>
Create a new parse validator.
Sourcepub fn validate(&mut self, source: &str) -> Result<(), ValidationError>
pub fn validate(&mut self, source: &str) -> Result<(), ValidationError>
Validate that source has no parse errors.
Sourcepub fn validate_file(
&mut self,
path: impl AsRef<Path>,
) -> Result<(), ValidationError>
pub fn validate_file( &mut self, path: impl AsRef<Path>, ) -> Result<(), ValidationError>
Validate a file path.
Sourcepub fn validate_edit(
&mut self,
original: &str,
edited: &str,
) -> Result<(), ValidationError>
pub fn validate_edit( &mut self, original: &str, edited: &str, ) -> Result<(), ValidationError>
Compare two sources and check if new errors were introduced.
Returns Ok if the edited source doesn’t introduce new parse errors that weren’t in the original.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParseValidator
impl RefUnwindSafe for ParseValidator
impl Send for ParseValidator
impl Sync for ParseValidator
impl Unpin for ParseValidator
impl UnsafeUnpin for ParseValidator
impl UnwindSafe for ParseValidator
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