tag | 84ea7ce41738542df4b4703dce74d1ff1aa69725 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Fri Sep 17 01:19:59 2021 -0700 |
object | d41fcde3b6b708164a0627f6dd108816f317fbc2 |
Platform Tools Release 31.0.3 (7562133)
commit | d41fcde3b6b708164a0627f6dd108816f317fbc2 | [log] [tgz] |
---|---|---|
author | android-build-prod (mdb) <android-build-team-robot@google.com> | Thu Mar 04 00:39:28 2021 +0000 |
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | Thu Mar 04 00:39:28 2021 +0000 |
tree | c9a58f4fc6663d85c63dcb9f4a8cf00c85f3993e | |
parent | eabceb7d1b6c7ef80f286f7e0994c3a2555c925f [diff] | |
parent | 9e19b88e6d25aadd6c1d7e0e2d6e640a3aa7235e [diff] |
Snap for 7183507 from 9e19b88e6d25aadd6c1d7e0e2d6e640a3aa7235e to sdk-release Change-Id: Idf850de973b9de2f0391b109f3b9c47c6ece10b1
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.