[−][src]Crate num_derive
Procedural macros to derive numeric traits in Rust.
Usage
Add this to your Cargo.toml
:
[dependencies]
num-traits = "0.2"
num-derive = "0.2"
Then you can derive traits on your own types:
#[macro_use] extern crate num_derive; #[derive(FromPrimitive, ToPrimitive)] enum Color { Red, Blue, Green, }
Derive Macros
Float | Derives |
FromPrimitive | Derives |
Num | Derives |
NumCast | Derives |
NumOps | Derives |
One | Derives |
ToPrimitive | Derives |
Zero | Derives |