Function std::panic::resume_unwind 1.9.0[−][src]
Expand description
在不调用 panic 钩子的情况下触发 panic。
它被设计为与 catch_unwind
结合使用,例如,跨 C 代码层携带 panic。
Notes
请注意,Rust 中的 panics 并不总是通过展开来实现,但是可以通过中止进程来实现。 如果以这种方式实现 panics 时调用了此函数,则此函数将终止进程,而不触发 unwind。
Examples
ⓘ
use std::panic;
let result = panic::catch_unwind(|| {
panic!("oh no!");
});
if let Err(err) = result {
panic::resume_unwind(err);
}
Run