commit | ffaa3fed1608ce6849bb7c528bed8f99421da125 | [log] [tgz] |
---|---|---|
author | James Farrell <[email protected]> | Fri Oct 11 15:41:17 2024 +0000 |
committer | James Farrell <[email protected]> | Fri Oct 11 15:41:17 2024 +0000 |
tree | 99a49b7268515de3aac1148f8535afd9e6ad9267 | |
parent | df9d261045881d49c82bfe2c6c76ba20a7a3ec42 [diff] |
Migrate 20 crates to monorepo oneshot-uniffi minimal-lexical num_enum num_enum_derive num-complex num-derive paste pin-utils predicates protobuf-parse protobuf-support quote remain rustc-demangle-capi rustix shared_child thiserror-impl threadpool tikv-jemalloc-sys tonic Bug: http://b/339424309 Test: treehugger Change-Id: Ifbdd0af1f7b301334c69b74cdea4af8a44ab24ae
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.