commit | 2fb3d6b2fc4f99b3ea33ecde534c6637e7c6f195 | [log] [tgz] |
---|---|---|
author | David Brazdil <dbrazdil@google.com> | Tue Jan 24 17:22:51 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Jan 24 17:22:51 2023 +0000 |
tree | b2e3498fe7f97d1005a3571f45012f4d571bc11a | |
parent | 2b706fe77baadaa626c0da3ad66b69a9eff41d02 [diff] | |
parent | 8ac8cdb21c85016e6ef93be102495e1af8c8766a [diff] |
Update TEST_MAPPING am: 8ac8cdb21c Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2398965 Change-Id: I25f49cc4056062aec6b34bb81937ed3535b45553 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.