commit | 6f525cac0f9eda6fbf85ef4b9e3d1424cbae6901 | [log] [tgz] |
---|---|---|
author | Android Build Role Account android-build-prod <android-build-team-robot@google.com> | Fri Nov 20 11:08:56 2020 +0000 |
committer | Android Build Role Account android-build-prod <android-build-team-robot@google.com> | Fri Nov 20 11:08:56 2020 +0000 |
tree | 66333ecac74c5b21a5d6b4d4d2b354e4e7556c19 | |
parent | f3e6958e3ffcaaffc9754357b4e093d9b9167054 [diff] | |
parent | a0555b315af11ae4a6bd2bd2e3100af35e3c6dac [diff] |
Snap for 6985099 from a0555b315af11ae4a6bd2bd2e3100af35e3c6dac to s-keystone-qcom-release Change-Id: I46d7297310e063d8a32eb6cc6ef589d8e6b62247
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.