Skip to main content

Recovered

Struct Recovered 

Source
pub struct Recovered<S: SourceStore = Arc<str>, X: Extension = NoExt> { /* private fields */ }
Expand description

The result of a recovering parse: the partial AST plus every collected error.

Composes the owned Parsed root — the sole holder of the source and resolver that give the recovered statements meaning — with the out-of-band diagnostics for the statements that failed to parse. A fully well-formed script yields the same statements as parse_with and an empty errors; a broken statement is absent from the tree and present in errors (no error nodes).

Implementations§

Source§

impl<S: SourceStore, X: Extension> Recovered<S, X>

Source

pub fn parsed(&self) -> &Parsed<S, X>

The owned Parsed root of the well-formed statements, with the source and resolver they were parsed against. Use it exactly like a parse_with result — render, resolve symbols, query line/column.

Source

pub fn statements(&self) -> &[Statement<X>]

The recovered statements, in source order — shorthand for parsed().statements().

Source

pub fn errors(&self) -> &[ParseError]

Every collected parse error, in source order — one per statement that failed.

Each carries its byte Span, so a diagnostic can resolve line/column through the parsed root’s span_line_col. Empty when the whole script parsed.

Source

pub fn has_errors(&self) -> bool

Whether any statement failed to parse.

Source

pub fn into_parts(self) -> (Parsed<S, X>, Vec<ParseError>)

Split into the owned Parsed root and the collected errors.

Trait Implementations§

Source§

impl<S: Debug + SourceStore, X: Debug + Extension> Debug for Recovered<S, X>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S = Arc<str>, X = NoExt> !Freeze for Recovered<S, X>

§

impl<S, X> RefUnwindSafe for Recovered<S, X>

§

impl<S, X> Send for Recovered<S, X>
where S: Send, X: Send,

§

impl<S, X> Sync for Recovered<S, X>
where S: Sync, X: Sync,

§

impl<S, X> Unpin for Recovered<S, X>
where S: Unpin, X: Unpin,

§

impl<S, X> UnsafeUnpin for Recovered<S, X>
where S: UnsafeUnpin,

§

impl<S, X> UnwindSafe for Recovered<S, X>
where S: UnwindSafe, X: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.