commit | fd2dcef001300746d2f4d5ebe68453380c6fc03e | [log] [tgz] |
---|---|---|
author | Matthew Maurer <mmaurer@google.com> | Fri May 26 20:22:57 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri May 26 20:22:57 2023 +0000 |
tree | 013695c6c3323ccdb9c6dccb7357753d563bcf9e | |
parent | a5d61d26277a7e5b28265d2ad4bd23faf877f6d9 [diff] | |
parent | 559b5f310704d3d7fc82917b5d3c1189f8ec5f2d [diff] |
Update to syn-2 am: 559b5f3107 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2520538 Change-Id: I68e7e6093ff9203fda97ccf9785ffd4d93238bd8 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.