| Crates.io | enumizer |
| lib.rs | enumizer |
| version | 0.1.2 |
| created_at | 2025-12-11 16:58:12.326318+00 |
| updated_at | 2025-12-21 07:57:01.731973+00 |
| description | simple macros for generating enums that are equivalent and convertible to standard library enums |
| homepage | |
| repository | https://github.com/nihohit/enumizer |
| max_upload_size | |
| id | 1980134 |
| size | 33,644 |
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>.