pub trait UnwrapOrErr<T> {
// Required method
fn unwrap_or_err(self) -> T;
}Expand description
Returns the contained value from either variant of a Result<T, T>.
Unlike unwrap_or_default, the Err branch retains its value instead of
constructing T::default().
Required Methods§
Sourcefn unwrap_or_err(self) -> T
fn unwrap_or_err(self) -> T
Returns the value carried by either result variant.
Both variants contain the same type, so neither branch needs conversion. The result is consumed without constructing a fallback value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".