NonMaxU32 and friends
Hi! Why there are NonZero* types, but no NonMax* types? From my point of view, NonZero used mainly as an index in a collection. In this case", you have to -1, +1 it on every use.
Is it maybe, possible to introduce an InvalidValue trait which can be used to define your own "special" value for arbitrary type? Something similar I'm using here: https://docs.rs/obj-pool/0.2.0/src/obj_pool/invalid_value.rs.html#4-6
And for this special trait, we could implement compiler support to optimize memory footprint of Option<T> where T: InvalidValue.
Posted Aug 22, 2018, 3:28 PM UTC
2315