Function ring::polyfill::unwrap_const::unwrap_const

source ·
pub const fn unwrap_const<T>(x: Option<T>) -> T
where T: Copy,
Expand description

Polyfill for Option::unwrap() as a const fn; feature const_option. https://github.com/rust-lang/rust/issues/67441. TODO(MSRV): Replace this with x.unwrap().

T: Copy avoids “constant functions cannot evaluate destructors.”