Struct InFlightException

Source
pub struct InFlightException<E>(/* private fields */);
Expand description

Not-quite-caught exception.

This type is returned by intercept when an exception is caught. Exception handling is not yet done at that point: it’s akin to entering a catch clause in C++.

At this point, you can either drop the handle, which halts the Lithium machinery and brings you back to the sane land of Result, or call InFlightException::rethrow to piggy-back on the contexts of the caught exception.

Implementations§

Source§

impl<E> InFlightException<E>

Source

pub unsafe fn rethrow<F>(self, new_cause: F) -> !

Throw a new exception by reusing the existing context.

See intercept docs for examples and safety notes.

§Safety

See the safety section of this crate for information on matching types.

In addition, the caller must ensure that the exception can only be caught by Lithium functions and not by the system runtime. The list of banned functions includes std::panic::catch_unwind and std::thread::spawn.

For this reason, the caller must ensure no frames between rethrow and catch can catch the exception. This includes not passing throwing callbacks to foreign crates, but also not using rethrow in own code that might intercept an exception without cooperation with the throwing side.

Auto Trait Implementations§

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.