inner::some! [] [src]

macro_rules! some {
    ($x:expr, if $i:path, else |$e:ident| $b:block) => { ... };
    ($x:expr, if $i:path, else $b:block) => { ... };
    ($x:expr, if $i:path) => { ... };
}

Converts your enum to an Option.

Examples

assert_eq!(some!(Fruit::Apple(15), if Fruit::Apple), Some(15));
assert_eq!(some!(Fruit::Orange(5), if Fruit::Apple), None);