Struct scope_guard::CatchUnwindFut
source · pub struct CatchUnwindFut<F: UnwindSafe>(pub F);
Expand description
Wraps to propagate panic as error.
Example
use scope_guard::CatchUnwindFut;
async fn my_fut() -> Result<(), bool> {
Err(true)
}
async fn example() {
match CatchUnwindFut(my_fut()).await {
Ok(Ok(())) => panic!("Success!?"),
Ok(Err(res)) => assert!(res),
Err(panic) => std::panic::resume_unwind(panic),
}
}
Tuple Fields§
§0: F
Trait Implementations§
Auto Trait Implementations§
impl<F> RefUnwindSafe for CatchUnwindFut<F>where F: RefUnwindSafe,
impl<F> Send for CatchUnwindFut<F>where F: Send,
impl<F> Sync for CatchUnwindFut<F>where F: Sync,
impl<F> Unpin for CatchUnwindFut<F>where F: Unpin,
impl<F> UnwindSafe for CatchUnwindFut<F>
Blanket Implementations§
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere F: Future,
§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more