Android VTS 12.0 Release 2 (7973604)
Snap for 7160059 from 7c087e53655799f010f67023f96094253d50269f to sc-release

Change-Id: I786c94189ad77acdbbff3626de80c082ffed2faf
tree: c9a58f4fc6663d85c63dcb9f4a8cf00c85f3993e
  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. OWNERS
  13. README.md
  14. 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.

License

Licensed under either of

at your option.

Contribution

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.