ErrorStore

Struct ErrorStore 

Source
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>

Source

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.

Source

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.

Source

pub fn push_error(&self, error: E)

Source

pub fn take_all(&self) -> Vec<(impl Display + 'tcx, E)>

Trait Implementations§

Source§

impl<'tcx, E: Default> Default for ErrorStore<'tcx, E>

Source§

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.