1 unstable release
Uses old Rust 2015
0.1.0 | May 12, 2018 |
---|
#1197 in Development tools
1,878 downloads per month
Used in 12 crates
(6 directly)
3KB
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));
}
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.