pub enum ParsingResult<T> {
Ok(T),
Failed(Vec<Diagnostic>),
Partial(T, Vec<Diagnostic>),
}Expand description
Result of parsing.
Variants§
Ok(T)
Fully valid ast that was parsed without errors.
Failed(Vec<Diagnostic>)
The ast contain invalid starting tokens, and cannot be parsed.
Partial(T, Vec<Diagnostic>)
The ast can be partially parsed, but some tokens was skipped during parsing, or their meaning was changed.
Implementations§
Source§impl<T> ParsingResult<T>
impl<T> ParsingResult<T>
Sourcepub fn from_parts(value: Option<T>, errors: Vec<Diagnostic>) -> Self
pub fn from_parts(value: Option<T>, errors: Vec<Diagnostic>) -> Self
Create new ParsingResult from optional value and accumulated errors.
Sourcepub fn into_result(self) -> Result<T>
pub fn into_result(self) -> Result<T>
Convert into syn::Result, with fail on first diagnostic message,
Ignores any diagnostic non error message when result is available.
Returns Error on ParsingResult::Failed, and
ParsingResult::Partial.
pub fn split(self) -> (Option<T>, Vec<Diagnostic>)
pub fn push_diagnostic(&mut self, diagnostic: Diagnostic)
pub fn is_ok(&self) -> bool
Source§impl<T> ParsingResult<Vec<T>>
impl<T> ParsingResult<Vec<T>>
pub fn split_vec(self) -> (Vec<T>, Vec<Diagnostic>)
pub fn from_parts_vec(value: Vec<T>, errors: Vec<Diagnostic>) -> Self
Trait Implementations§
Source§impl<T: Debug> Debug for ParsingResult<T>
impl<T: Debug> Debug for ParsingResult<T>
Auto Trait Implementations§
impl<T> Freeze for ParsingResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for ParsingResult<T>where
T: RefUnwindSafe,
impl<T> !Send for ParsingResult<T>
impl<T> !Sync for ParsingResult<T>
impl<T> Unpin for ParsingResult<T>where
T: Unpin,
impl<T> UnwindSafe for ParsingResult<T>where
T: UnwindSafe,
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