Crates.io | enumx |
lib.rs | enumx |
version | 0.4.3 |
source | src |
created_at | 2018-11-20 17:38:57.625668 |
updated_at | 2021-04-04 11:48:01.996257 |
description | Ad-hoc enum extension. |
homepage | |
repository | https://github.com/oooutlk/enumx |
max_upload_size | |
id | 97801 |
size | 44,443 |
Simulating ad-hoc enums which
can be converted between enums that share a common set of variant types.
can implement traits that haven been implemented by all variants.
Add this crate to Cargo.toml
Cargo.toml
:
enumx = "0.4"
Add this if you want to support up to 32 variants:
features = ["enum32"]
src/lib.rs
:
use enumx::export::*;
If you want to use predefined enum types:
use enumx::predefined::*;
"union types" simulation, aka "enum exchange".
summaries into an enum, the returned values of different types by functions
that returns impl Trait
.
macros to help implementing traits for enums the variants of which have all implemented the traits.
See the enumx book for more.
Licensed under MIT.