Macro choice::choice_at[][src]

macro_rules! choice_at {
    (0, $v:ident) => { ... };
    (1, $v:ident) => { ... };
    (2, $v:ident) => { ... };
    (3, $v:ident) => { ... };
    (4, $v:ident) => { ... };
    (5, $v:ident) => { ... };
    (6, $v:ident) => { ... };
    (7, $v:ident) => { ... };
    (8, $v:ident) => { ... };
    (9, $v:ident) => { ... };
}

Syntactic sugar for destructuring a Choice between multiple types.

See also choice_unreachable.

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!();
    }
}