commit | 84c69a80d609003cc5440610b787899a3fc3ab79 | [log] [tgz] |
---|---|---|
author | Android Build Role Account android-build-prod <android-build-team-robot@google.com> | Thu Oct 15 18:47:13 2020 +0000 |
committer | Android Build Role Account android-build-prod <android-build-team-robot@google.com> | Thu Oct 15 18:47:13 2020 +0000 |
tree | 61f8cf9de82b1871077110126fbb23316afbde28 | |
parent | 15a8a05fb76ee97c116096255a40bdfc3af410b6 [diff] | |
parent | 297d66ebb89ccf6269ba5d70eb2fd18790f50f1b [diff] |
Snap for 6908147 from 297d66ebb89ccf6269ba5d70eb2fd18790f50f1b to s-keystone-qcom-release Change-Id: Ibf6349837e4e29d162360d61fac6c279bf677300
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.