5 ms·
> Somewhat related to the above, all array indexes are just numbers. Create your own type[0] encapsulating arrays, and then implement the Index[1] with a custo
by the8472 2y ago
> Somewhat related to the above, all array indexes are just numbers.
Create your own type[0] encapsulating arrays, and then implement the Index[1] with a custom Idx generic.
> In Ada and enumeration is a valid type to use as an array index, or a range from 5 to 15, or -123 to 7
That's what TFA is about.
[0] https://doc.rust-lang.org/rust-by-example/generics/new_types.html https://doc.rust-lang.org/rust-by-example/generics/new_types...
[1] https://doc.rust-lang.org/std/ops/trait.Index.html https://doc.rust-lang.org/std/ops/trait.Index.html