Skip to main content

UnwrapInfallible

Trait UnwrapInfallible 

Source
pub trait UnwrapInfallible<T> {
    // Required method
    fn unwrap_infallible(self) -> T;
}
Expand description

Extracts the value from a result whose error type is uninhabited.

Only the Ok branch can be constructed for Result<T, Infallible>. The implementation uses an unchecked unwrap after a debug assertion.

Required Methods§

Source

fn unwrap_infallible(self) -> T

Returns the only constructible value from the result.

The uninhabited error type makes the Err branch unreachable. Consuming the result requires no fallback value or closure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§