std-function

resume_unwind — propagate a caught panic

Re-raise a captured panic payload without running the hook again. Under an unwind strategy a higher boundary can catch it. Under an abort strategy this operation aborts. Expected stdout (not executed): true Common mistake: Treating resume_unwind as a normal return or a new recoverable error.

Formal Syntax & Structure

rust syntaxrust
pub fn resume_unwind(payload: Box<dyn std::any::Any + Send>) -> !

Working Example

Example Snippetrust
fn main() {    let outer = std::panic::catch_unwind(|| {        if let Err(payload) = std::panic::catch_unwind(|| panic!("demo")) {            std::panic::resume_unwind(payload);        }    });    println!("{}", outer.is_err());}
Rust Reference