Skip to content

XAMPPRocky/unwrap_to

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unwrap_to

Build status Documentation Donate using Liberapay

A simple utility macro that allows you to easily unwrap a ADT(Algebraic 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));
}

About

A Rust utility macro to unwrap enums.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages