pub struct Parse<T> { /* private fields */ }Expand description
The result of a parse operation.
Returns the syntax tree even if there are parse errors. Use errors()
or positioned_errors() to check for errors if needed.
This allows for error-resilient tooling that can work with partial or invalid input.
Implementations§
Source§impl<T> Parse<T>
impl<T> Parse<T>
Sourcepub fn tree(&self) -> T
pub fn tree(&self) -> T
The parse tree. If there were no parse errors, this is a valid tree. If there were parse errors, this tree might be only partially valid.
Sourcepub fn positioned_errors(&self) -> &[PositionedParseError]
pub fn positioned_errors(&self) -> &[PositionedParseError]
Positioned parse errors with location information.
Sourcepub fn errors(&self) -> Vec<String>
pub fn errors(&self) -> Vec<String>
Parse error messages, if any, each prefixed with its line:column.
Sourcepub fn to_result(self) -> Result<T, YamlError>
pub fn to_result(self) -> Result<T, YamlError>
Convert parse result to a Result, failing with the first error if any.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether the parse had any errors.
Trait Implementations§
impl<T: Eq> Eq for Parse<T>
impl<T: PartialEq> StructuralPartialEq for Parse<T>
Auto Trait Implementations§
impl<T> Freeze for Parse<T>
impl<T> RefUnwindSafe for Parse<T>
impl<T> Send for Parse<T>
impl<T> Sync for Parse<T>
impl<T> Unpin for Parse<T>
impl<T> UnsafeUnpin for Parse<T>
impl<T> UnwindSafe for Parse<T>
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