from_int
Motivation
This crate provides an easy way to convert a plain integer into an enum type, something that rust can currently do natively in the opposite direction.
Usage
Usage of from_int
is extremely simple. Just add it as a dependency to your crate, then:
extern crate from_int; // contains the trait
extern crate from_int_derive; // contains the macro
use FromInt;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// This would panic:
assert_eq!;