commit | 20dff95b2a2cb8a8382b12338eb8390904bd615b | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <jeffv@google.com> | Tue Jan 31 21:21:22 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Jan 31 21:21:22 2023 +0000 |
tree | ce8936c4d32f4ddfa646fccf158fd64bb1d446c9 | |
parent | 2fb3d6b2fc4f99b3ea33ecde534c6637e7c6f195 [diff] | |
parent | e39b6d2dd3c0c7d7fb20f9973e455b769316f49f [diff] |
Update TEST_MAPPING am: e39b6d2dd3 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2411858 Change-Id: I18db86127518f804d8294dc04ed39f74660882c7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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.