To make it type safe, the Range struct can be wrapped in a type that implements a trait Parent with an associated type set to U. Generic algorithms can then be written to operate on the relationship between parent and children. This could be added to piston-range.
The basic idea is that
Vec<T>
points toVec<U>
whereT
is a range. Could use https://github.com/pistondevelopers/rangeTo make it type safe, the
Range
struct can be wrapped in a type that implements a traitParent
with an associated type set toU
. Generic algorithms can then be written to operate on the relationship between parent and children. This could be added to piston-range.