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