commit | 5da145e9d6169f34f30935ac3a5953f3b083bb9d | [log] [tgz] |
---|---|---|
author | Haibo Huang <[email protected]> | Thu Nov 05 04:25:36 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Nov 05 04:25:36 2020 +0000 |
tree | 66333ecac74c5b21a5d6b4d4d2b354e4e7556c19 | |
parent | 7be029b9172a9d84bc76d82e0a8cefe5e54ec28b [diff] | |
parent | 8f7a116898aedc75f9b1601e69affa5fda440a7d [diff] |
Upgrade rust/crates/num-derive to 0.3.3 am: b858c52f1f am: 4dd1a71c2a am: 8f7a116898 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/1480701 Change-Id: I03aaa57e9e738c0367bf8762ae06e9e4703bbf2a
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.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.