Macro choice::choice_unreachable[][src]

macro_rules! choice_unreachable {
    (1) => { ... };
    (2) => { ... };
    (3) => { ... };
    (4) => { ... };
    (5) => { ... };
    (6) => { ... };
    (7) => { ... };
    (8) => { ... };
    (9) => { ... };
}

Syntactic sugar for an unreachable Choice, which is only needed because the Rust exhaustiveness checker is unable to infer that Never is uninhabited.

See also choice_at.

This macro will no longer be necessary once exhaustive_patterns stabilizes.

Example

use choice::{Choice, choice, choice_at, choice_unreachable};
let c: choice![u8, char] = Choice::new('2').or();
match c {
    choice_at!(0, v) => {
        panic!("Unexpected match: {}", v);
    }
    choice_at!(1, v) => {
        assert_eq!(v, '2');
    }
    choice_unreachable!(2) => {
        unreachable!();
    }
}