commit | f8ece0a21e1c79286f0d3c7866f16f7385e45140 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Sat May 27 02:52:09 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Sat May 27 02:52:09 2023 +0000 |
tree | 013695c6c3323ccdb9c6dccb7357753d563bcf9e | |
parent | c88059cafb9fb8221c508323b6c5138753aa749d [diff] | |
parent | f559f9cf6587a63bad4189b8720f63ed969f9bc8 [diff] |
Update to syn-2 am: 559b5f3107 am: fd2dcef001 am: fe0607416e am: 8ebd4e87c0 am: d11887ffec am: f559f9cf65 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/2520538 Change-Id: Id7684883cc743d4ece0ad99e5acfb04fe963a2dd 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.