commit | cb4c9d0fe5fd8d3c8cb454fe265a22bea28cdc19 | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <[email protected]> | Tue Jan 31 23:12:48 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Jan 31 23:12:48 2023 +0000 |
tree | ce8936c4d32f4ddfa646fccf158fd64bb1d446c9 | |
parent | 52ff10b5473c2de58a58a6912f78958c934c3aac [diff] | |
parent | 608c504629769af1654870d66545735ff42444d7 [diff] |
Update TEST_MAPPING am: e39b6d2dd3 am: 20dff95b2a am: 608c504629 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2411858 Change-Id: I35aaae2d20c2f119b4f98f2a0b4cff6e384515a4 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.