pub trait PanicPayload: Display {
// Required methods
fn take_box(&mut self) -> Box<dyn Any + Send>;
fn get(&mut self) -> &(dyn Any + Send);
// Provided method
fn as_str(&mut self) -> Option<&str> { ... }
}🔬This is a nightly-only experimental API. (
std_internals)Expand description
An internal trait used by std to pass data from std to panic_unwind and
other panic runtimes. Not intended to be stabilized any time soon, do not
use.
Required Methods§
Sourcefn take_box(&mut self) -> Box<dyn Any + Send>
🔬This is a nightly-only experimental API. (std_internals)
fn take_box(&mut self) -> Box<dyn Any + Send>
std_internals)Take full ownership of the contents.
After this method got called, only some dummy default value is left in self.
Calling this method twice, or calling get after calling this method, is an error.
The argument is borrowed because the panic runtime (__rust_start_panic) only
gets a borrowed dyn PanicPayload.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".