enumizer 0.1.1

simple macros for generating enums that are equivalent and convertible to standard library enums
Documentation
  • Coverage
  • 80%
    36 out of 45 items documented3 out of 37 items with examples
  • Size
  • Source code size: 22.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.27 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • nihohit/enumizer
    0 0 2
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nihohit

This crate provides simple macros for generating enums that are equivalent and convertible to standard library enums, with user-chosen variant names, in order to increase code legibility. So alias_option!(Value, Found, Searching); becomes

enum Value<T> {
  Found(T),
  Searching
}

and alias_result!(Response, Success, Failure); becomes

enum Response<T,U> {
  Success(T),
  Failure(U)
}

and the generated types have all equivalent functions is_found_and (or most, depending on whether we implemented them yet or not :) ). That is, if Option<T> has is_some_and, Value<T> has is_found_and. And if your codebase requires actual Result or Option types, just use into - we implement From<Option/Result> and Into<Option/Result>.