Function unreachable_checked
pub const fn unreachable_checked<T>(_: T) -> !where
T: Never,
Available on crate feature
dep_rkyv
only.Expand description
Consumes a Never
type, returning a primitive !
.
This is a safe version of unreachable_unchecked
for Never
types.
ยงExample
use rancor::{unreachable_checked, Infallible};
let result = Ok::<i32, Infallible>(10);
match result {
Ok(i) => println!("i"),
Err(e) => unreachable_checked(e),
}