| commit | 36c44ed492404125c1af2e3fdad988d4dc725a5c | [log] [tgz] |
|---|---|---|
| author | Haibo Huang <hhb@google.com> | Mon Aug 24 19:24:54 2020 -0700 |
| committer | Haibo Huang <hhb@google.com> | Mon Aug 24 19:24:54 2020 -0700 |
| tree | 2b09f2fd7cc61efe19054ff97a23edabb0c48bf9 | |
| parent | f22aa339eae592584748c84f2892ced2f5040cdd [diff] |
Upgrade rust/crates/num-derive to 0.3.2 Test: make Change-Id: I4959f21dda8a05969c21121d25b3a68faed8af5e
Procedural macros to derive numeric traits in Rust.
Add this to your Cargo.toml:
[dependencies] num-traits = "0.2" num-derive = "0.3"
and this to your crate root:
#[macro_use] extern crate num_derive;
Then you can derive traits on your own types:
#[derive(FromPrimitive, ToPrimitive)] enum Color { Red, Blue, Green, }
full-syntax — Enables num-derive to handle enum discriminants represented by complex expressions. Usually can be avoided by utilizing constants, so only use this feature if namespace pollution is undesired and compile time doubling is acceptable.Release notes are available in RELEASES.md.
The num-derive crate is tested for rustc 1.31 and greater.