macro_rules! flatten {
($opt:expr $(,)? ) => { ... };
}
Expand description
A const equivalent of Option::flatten
§Const stabilization
The equivalent std function was const-stabilized in Rust 1.83.0.
§Example
use konst::option;
const ARR: &[Option<u32>] = &[
option::flatten!(Some(Some(8))),
option::flatten!(None),
];
assert_eq!(ARR, &[Some(8), None]);