Fix num-derive/METADATA

Bug: 166324735
Test: make
Change-Id: I793af3d8183e9224e127259cc5c62d5a5d9938c5
1 file changed
tree: 926f4fbc1b07deead6970f1e7d8676da481a3436
  1. src/
  2. tests/
  3. .cargo_vcs_info.json
  4. .gitignore
  5. Android.bp
  6. Cargo.toml
  7. Cargo.toml.orig
  8. LICENSE-APACHE
  9. LICENSE-MIT
  10. METADATA
  11. MODULE_LICENSE_APACHE2
  12. README.md
  13. RELEASES.md
README.md

num-derive

crate documentation minimum rustc 1.31 build status

Procedural macros to derive numeric traits in Rust.

Usage

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,
}

Optional features

  • 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.

Releases

Release notes are available in RELEASES.md.

Compatibility

The num-derive crate is tested for rustc 1.31 and greater.