pub struct Recovered<T> { /* private fields */ }Expand description
A compiler product retained even when recovery emits diagnostics.
Recovered deliberately never uses Result: syntax and type problems are
compiler data, while callers always retain an inspectable product.
Implementations§
Source§impl<T> Recovered<T>
impl<T> Recovered<T>
Sourcepub fn new(product: T, diagnostics: Vec<Diagnostic>) -> Self
pub fn new(product: T, diagnostics: Vec<Diagnostic>) -> Self
Retains product and canonically orders its diagnostics.
Sourcepub fn into_product(self) -> T
pub fn into_product(self) -> T
Consumes the wrapper while retaining the recovered product.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Returns diagnostics in canonical order.
Sourcepub fn into_parts(self) -> (T, Vec<Diagnostic>)
pub fn into_parts(self) -> (T, Vec<Diagnostic>)
Consumes the wrapper into its product and canonically ordered diagnostics.
Sourcepub fn map<U>(self, transform: impl FnOnce(T) -> U) -> Recovered<U>
pub fn map<U>(self, transform: impl FnOnce(T) -> U) -> Recovered<U>
Transforms the retained product without discarding recovery diagnostics.
Sourcepub fn with_diagnostic(self, diagnostic: Diagnostic) -> Self
pub fn with_diagnostic(self, diagnostic: Diagnostic) -> Self
Returns a new wrapper with one additional diagnostic in canonical order.
Trait Implementations§
impl<T: Eq> Eq for Recovered<T>
impl<T: PartialEq> StructuralPartialEq for Recovered<T>
Auto Trait Implementations§
impl<T> Freeze for Recovered<T>where
T: Freeze,
impl<T> RefUnwindSafe for Recovered<T>where
T: RefUnwindSafe,
impl<T> Send for Recovered<T>where
T: Send,
impl<T> Sync for Recovered<T>where
T: Sync,
impl<T> Unpin for Recovered<T>where
T: Unpin,
impl<T> UnsafeUnpin for Recovered<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Recovered<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