#traits #enums #index #deriving #dealing

custom_enum_traits

A set of traits for dealing with enums

2 unstable releases

0.2.0 Feb 16, 2022
0.1.0 Feb 13, 2022

#2112 in Rust patterns


Used in derive_custom_enum_traits

MIT license

3KB

custom_enum_traits

This is designed to become a set of traits designed to make it easier to work with enums. Currently, there is just one trait, though this may change. Ultimately, all of these traits are likely to be designed so they are derive-able. The library for deriving these traits is derive_custom_enum_traits.


lib.rs:

A small library devoted to adding custom information, like indexing, to enums.

Note that these traits are useless when they are not accompanied by the derive_custom_enum_traits library, which automatically derives these traits.

The utilities should be fairly straightforward ones, such as a custom trait that indexes an enum's placement. I'm using this in a library so I can hold information in an array, where each item in the array refers to a different item in an enum.

No runtime deps