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 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.
The returned YamlError::Parse contains the error message but no
line/column information because Parse does not retain the source
text. Use YamlFile::from_str (which calls
byte_offset_to_line_column internally) if you need precise positions
in error messages.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether the parse had any errors.