commit | 6acf04bb2e23da386651bf4b2491f46b74836fa3 | [log] [tgz] |
---|---|---|
author | Andrew Walbran <[email protected]> | Fri Nov 10 07:01:05 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Nov 10 07:01:05 2023 +0000 |
tree | 7af162db7ed50bc535901cb51ec5c4bd9b9c3ec7 | |
parent | f92cd3a93d799f9413744fb3c4d3ef2c8acc2d3d [diff] | |
parent | ca9335c8abf05bf17e5e95581e009ef2064214e4 [diff] |
Migrate to cargo_embargo. am: 13f024459d am: b4a8370cb4 am: ca9335c8ab Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2822529 Change-Id: I1cc0ca9fae6bff4640cf1115282c94f9dfac18e1 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.