commit | 52ff10b5473c2de58a58a6912f78958c934c3aac | [log] [tgz] |
---|---|---|
author | David Brazdil <[email protected]> | Tue Jan 24 18:55:31 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Jan 24 18:55:31 2023 +0000 |
tree | b2e3498fe7f97d1005a3571f45012f4d571bc11a | |
parent | 42f1d944fc679f6e4fccf0859652bbdbeeff7a0c [diff] | |
parent | 1a92f74f418e177dd01dbef5deb089dba4cbfd1d [diff] |
Update TEST_MAPPING am: 8ac8cdb21c am: 2fb3d6b2fc am: 1a92f74f41 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2398965 Change-Id: Ib4895f5e7629714eef121477cba4c48e0c0ff0ed Signed-off-by: Automerger Merge Worker <[email protected]>
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.