1 unstable release

0.1.0 May 12, 2018

#187 in Development tools

Download history 1658/week @ 2019-12-01 1406/week @ 2019-12-08 386/week @ 2019-12-15 297/week @ 2019-12-22 193/week @ 2019-12-29 160/week @ 2020-01-05 113/week @ 2020-01-12 133/week @ 2020-01-19 65/week @ 2020-01-26 135/week @ 2020-02-02 272/week @ 2020-02-09 136/week @ 2020-02-16 135/week @ 2020-02-23 151/week @ 2020-03-01 177/week @ 2020-03-08 68/week @ 2020-03-15

5,879 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