subenum
Subenum is a simple proc-macro to derive subsets of enums. It allows conversion
between the parent and the child, will derive any traits on the child that you
have on the parent, and will implement PartialEq between the parent and child
if you derive it on the parent.
Simple Example
I think the simplest way to explain it is with an example:
use subenum;
Complex Example
In addition to simple enums and built-in traits, subenum works with complex
enums and third-party attributes.
use subenum;
Subenum-specific proc-macros
Maybe you have an enum that can't be Copyd, but the subenum can, and you want
to derive it:
use subenum;
Limitations
Bound lifetimes (e.g. for<'a, 'b, 'c>) are not currently supported. Please
open a ticket if these are desired.
Features
default-stdanderror_traitstd- Use standard library collections and allocators within this proc macroerror_trait- ImplementErrorforConvertErrortypes.- When combined with nightly and
#![feature(error_in_core)]supports#[no_std] - Otherwise, this feature requires
stdas well.
- When combined with nightly and
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.