pub struct ParseResult {
pub document: Option<Document>,
pub diagnostics: Vec<ParseDiagnostic>,
}Expand description
Unified parse result carrying an optional document and zero or more diagnostics.
The design mirrors chumsky’s output + errors semantics: a partial document
may coexist with diagnostics, so consumers always receive as much
information as the parser could extract.
Fields§
§document: Option<Document>Parsed document, present even when diagnostics exist for recovered input.
diagnostics: Vec<ParseDiagnostic>Zero or more diagnostics; empty on full success.
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn diagnostics(&self) -> &[ParseDiagnostic]
pub fn diagnostics(&self) -> &[ParseDiagnostic]
Borrow parse diagnostics.
Sourcepub fn into_diagnostics(self) -> Vec<ParseDiagnostic>
pub fn into_diagnostics(self) -> Vec<ParseDiagnostic>
Consume the result and return only diagnostics.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
true when a recovered document contains one or more Error nodes.
Sourcepub fn try_into_document(
self,
) -> Result<(Document, Vec<ParseDiagnostic>), ParseError>
pub fn try_into_document( self, ) -> Result<(Document, Vec<ParseDiagnostic>), ParseError>
Return the document and diagnostics when the document is editable.
Sourcepub fn into_parts(self) -> (Option<Document>, Vec<ParseDiagnostic>)
pub fn into_parts(self) -> (Option<Document>, Vec<ParseDiagnostic>)
Consume the result into its two public parts.
Trait Implementations§
Source§impl Clone for ParseResult
impl Clone for ParseResult
Source§fn clone(&self) -> ParseResult
fn clone(&self) -> ParseResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParseResult
impl RefUnwindSafe for ParseResult
impl Send for ParseResult
impl Sync for ParseResult
impl Unpin for ParseResult
impl UnsafeUnpin for ParseResult
impl UnwindSafe for ParseResult
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