pub trait ResultInfallibleExt<T>: Sealed {
// Required method
fn unwrap_infallible(self) -> T;
}Expand description
Extension trait that extracts the value from a Result whose error type is uninhabited.
The signature constrains callers at compile time: the method is only available when the
error type is core::convert::Infallible. No panics — the compiler proves the Err
arm unreachable from the type.
§Examples
use libdd_common::ResultInfallibleExt;
use std::convert::Infallible;
let result: Result<i32, Infallible> = Ok(42);
assert_eq!(result.unwrap_infallible(), 42);Required Methods§
fn unwrap_infallible(self) -> T
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".