pub trait FmtExpect<T> {
// Required method
fn expect_fmt(self, panic: impl FnOnce() -> !) -> T;
}Expand description
Use the unwrap_fmt! macro instead.
The only reason this exists is because Option and Result
have a different number of arguments for unwrap_or_else so
it’s not possible to use the same macro for both.
If you for whatever reason want your custom type to be unwrappable with this macro, then go ahead and implement this trait, I guess.
Required Methods§
fn expect_fmt(self, panic: impl FnOnce() -> !) -> T
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.