enum-impl-0.1.0 has been yanked.
enum-impl
enum-impl is a Rust procedural macro that simplifies working with enums by generating common methods and traits for each variant. This helps reduce boilerplate code and enhances the ergonomics of using enums in your Rust projects.
Features
[pub] as_ref [= "rename"]Generates a method that returns an immutable reference to the associated data of the enum variant.[pub] as_ref_mut [= "rename"]Generates a method that returns a mutable reference to the associated data of the enum variant.[pub] from [= "rename"]Generates a method that creates an instance of the enum variant from the associated data.impl fromImplements theFromtrait for the enum, creating an instance of the enum variant from the associated data.[pub] into [= "rename"]Generates a method that converts the enum into the variant associated data.[pub] is [= "rename"]Generates a method that returns a boolean indicating whether the enum instance matches the specified variant.
Usage
Add enum-impl to your Cargo.toml:
[]
= "0.1"
In your Rust code:
use EnumImpl;
More examples can be found in examples.