1 unstable release

Uses old Rust 2015

0.1.0 May 12, 2018

#380 in Development tools

Download history 15/week @ 2020-07-19 43/week @ 2020-07-26 23/week @ 2020-08-02 37/week @ 2020-08-09 29/week @ 2020-08-16 30/week @ 2020-08-23 69/week @ 2020-08-30 12/week @ 2020-09-06 80/week @ 2020-09-13 147/week @ 2020-09-20 136/week @ 2020-09-27 118/week @ 2020-10-04 89/week @ 2020-10-11 88/week @ 2020-10-18 127/week @ 2020-10-25 104/week @ 2020-11-01

202 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