tag | a9ba3678de2e59c1135c6274ad45256da927398c | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Wed Feb 01 16:52:02 2023 -0800 |
object | b4340b1ff4c8100b8731038fdb455220a41de8b1 |
Platform Tools Release 33.0.4 (9550387)
commit | b4340b1ff4c8100b8731038fdb455220a41de8b1 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 11:01:22 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 11:01:22 2023 +0000 |
tree | ce8936c4d32f4ddfa646fccf158fd64bb1d446c9 | |
parent | e024ec3ec7c04dc8f80850bb649d2ea1da01522c [diff] | |
parent | e39b6d2dd3c0c7d7fb20f9973e455b769316f49f [diff] |
Snap for 9550355 from e39b6d2dd3c0c7d7fb20f9973e455b769316f49f to sdk-release Change-Id: I33eb4ffb1131cfd36cd35a57ccf18599f3faca03
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.