Macro konst::result::err

source ·
macro_rules! err {
    ($res:expr $(,)?) => { ... };
}
Expand description

A const equivalent of Result::err

§Example

use konst::result;

// Necessary for type inference reasons.
type Res = Result<u32, u32>;

const ARR: &[Option<u32>] = &[
    result::err!(Res::Ok(3)),
    result::err!(Res::Err(8)),
];

assert_eq!(ARR, &[None, Some(8)]);