1 unstable release

0.1.0 May 12, 2018

#293 in Development tools

Download history 64/week @ 2020-01-25 132/week @ 2020-02-01 273/week @ 2020-02-08 136/week @ 2020-02-15 124/week @ 2020-02-22 163/week @ 2020-02-29 166/week @ 2020-03-07 79/week @ 2020-03-14 60/week @ 2020-03-21 55/week @ 2020-03-28 52/week @ 2020-04-04 26/week @ 2020-04-11 17/week @ 2020-04-18 8/week @ 2020-04-25 9/week @ 2020-05-02 55/week @ 2020-05-09

470 downloads per month
Used in 6 crates (4 directly)

MIT/Apache

3KB

unwrap_to

Build status

A simple utility macro that allows you to easily unwrap a ADT(Abstract Data Type) enum into a reference of its inner type.

#[macro_use] extern crate unwrap_to;
//!
enum Rule {
    String(String),
    Number(u64),
}
//!
fn main() {
    let rule = Rule::Number(7);
    assert_eq!(&7, unwrap_to!(rule => Rule::Number));
}

lib.rs:

unwrap_to

A simple utility macro that allows you to easily unwrap a ADT(Abstract Data Type) enum into a reference of its inner type.

#[macro_use] extern crate unwrap_to;

enum Rule {
    String(String),
    Number(u64),
}

fn main() {
    let rule = Rule::Number(7);
    assert_eq!(&7, unwrap_to!(rule => Rule::Number));
}

A simple utility macro that allows you to easily unwrap a ADT(Abstract Data Type) enum into a reference of its inner type.

No runtime deps