pub struct ErrorStore<'tcx, E> { /* private fields */ }Expand description
This type acts as a “store” for errors, which can be appended to. Keeps track of the context in which an error was generated.
You can use [set_context_ty()] and [set_context_method()] to set the context
as a type or method. They will return scope guards that will automatically pop the stack
once they go out of scope, so you don’t have to worry about errors originating from code
that does not set a context.
Implementations§
Source§impl<'tcx, E> ErrorStore<'tcx, E>
impl<'tcx, E> ErrorStore<'tcx, E>
Sourcepub fn set_context_ty<'a>(
&'a self,
ty: Cow<'tcx, str>,
) -> ErrorContextGuard<'a, 'tcx, E>
pub fn set_context_ty<'a>( &'a self, ty: Cow<'tcx, str>, ) -> ErrorContextGuard<'a, 'tcx, E>
Set the context to a named type. Will return a scope guard that will automatically clear the context on drop.
Sourcepub fn set_context_method<'a>(
&'a self,
method: Cow<'tcx, str>,
) -> ErrorContextGuard<'a, 'tcx, E>
pub fn set_context_method<'a>( &'a self, method: Cow<'tcx, str>, ) -> ErrorContextGuard<'a, 'tcx, E>
Set the context to a named method. Will return a scope guard that will automatically clear the context on drop.
pub fn push_error(&self, error: E)
pub fn take_all(&self) -> Vec<(impl Display + 'tcx, E)>
Trait Implementations§
Source§impl<'tcx, E: Default> Default for ErrorStore<'tcx, E>
impl<'tcx, E: Default> Default for ErrorStore<'tcx, E>
Source§fn default() -> ErrorStore<'tcx, E>
fn default() -> ErrorStore<'tcx, E>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'tcx, E> !Freeze for ErrorStore<'tcx, E>
impl<'tcx, E> !RefUnwindSafe for ErrorStore<'tcx, E>
impl<'tcx, E> Send for ErrorStore<'tcx, E>where
E: Send,
impl<'tcx, E> !Sync for ErrorStore<'tcx, E>
impl<'tcx, E> Unpin for ErrorStore<'tcx, E>where
E: Unpin,
impl<'tcx, E> UnwindSafe for ErrorStore<'tcx, E>where
E: 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more