commit | 778f7b2355d88f15222d43e9d46b41876b7ecceb | [log] [tgz] |
---|---|---|
author | James Farrell <jamesfarrell@google.com> | Wed May 22 23:28:04 2024 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed May 22 23:28:04 2024 +0000 |
tree | 65650c4914a01985b99ee66debf17a66908e958c | |
parent | 94eb0f7329701efe1e0f4916671391dc509c074d [diff] | |
parent | 429277df1924d80f148349de2eedc65af24f3aba [diff] |
Update Android.bp by running cargo_embargo am: 19625938af am: 429277df19 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/num-derive/+/3096317 Change-Id: I2b001b8f485a0e5237b0fef6bbd3941b34665c79 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.