Enum rstml::ParsingResult
source · 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,
Returns Error on ParsingResult::Failed, and
ParsingResult::Partial.
pub fn split(self) -> (Option<T>, Vec<Diagnostic>)
source§impl<T> ParsingResult<Vec<T>>
impl<T> ParsingResult<Vec<T>>
pub fn split_vec(self) -> (Vec<T>, Vec<Diagnostic>)
Trait Implementations§
Auto Trait Implementations§
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