Skip to content

Map index from/to enumerated value. #27

@aarkegz

Description

@aarkegz

Two methods (maybe with default implementations provided) to map index from/to enumerated value.

println!("{}", <i8 as Enumerable>::enumerable_index(-127).unwrap()); // "1", as -127 is the 1st (0-based) possible value of i8
println!("{}", <i8 as Enumerable>::enumerable_from_index(4).unwrap()); // "-124"

Metadata

Metadata

Assignees

Labels

breaking changeSomething should increment the major version numberderiveSomething related to auto-deriveenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions