commit | 4dd1a71c2a4b9972dcfd01c90c077adac092c117 | [log] [tgz] |
---|---|---|
author | Haibo Huang <hhb@google.com> | Thu Nov 05 03:37:13 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Nov 05 03:37:13 2020 +0000 |
tree | 66333ecac74c5b21a5d6b4d4d2b354e4e7556c19 | |
parent | b0b4bd6cd57da917b04fb59b6a3a78789a46d0c1 [diff] | |
parent | b858c52f1f7c02bf8a7289a8045242f51007d049 [diff] |
Upgrade rust/crates/num-derive to 0.3.3 am: b858c52f1f Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/1480701 Change-Id: I8e7482a80d0a5343d5b0cf49d07a0c20db83d9c9
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.