enum_helpers

Crates.ioenum_helpers
lib.rsenum_helpers
version0.0.4
sourcesrc
created_at2023-06-16 18:16:21.470877
updated_at2023-06-19 21:53:24.363713
descriptionAdds functions like is_, as_, as_mut_ and into_ to enums
homepage
repositoryhttps://github.com/crwn1337/enum_helpers
max_upload_size
id892496
size16,719
(crwn1337)

documentation

README

enum_helpers

github crates.io docs.rs

A Rust library to add helper functions to enums, with methods such as is_, as_, as_mut_, and into_, allowing you to simply your codebase and improve code readability.

Example Usage

The following example demonstrates the usage of the EnumIs derive macro to utilize a simpler type checking for enums.

use enum_helpers::EnumIs;

#[derive(EnumIs)]
pub enum Test {
    Example(u32),
}

pub fn main() {
    let test = Test::Example(123);
    assert!(test.is_example()); // true
}

Additional Resources

For more examples, refer to the tests directory.

To keep up with the latest features, improvements, and bug fixes, refer to the Changelog file.

Commit count: 8

cargo fmt