Note that generic associated types that are only generic over lifetime parameters (so not over type parameters) can be encoded using ordinary traits in stable rust:
// Only used with MutRef == &'a mut Self
// The &'a mut Self parameter gives rise to an implicit Self: 'a bound,
// which is important for the HRTB below to work.
trait HasReadDataIter<MutRef> {
type Iter: Iterator<Item = u16>;
}
// Higher-ranked trait bound (HRTB) as supertrait. Implicit bound from the &'a mut Self
// means this only ranges over 'a with Self: 'a
trait ReadData: for<'a> HasReadDataIter<&'a mut Self> {
fn read<'a>(&'a mut self) -> <Self as HasReadDataIter<&'a mut Self>>::Iter;
}
impl<'a, Ifc> HasReadDataIter<&'a mut Self> for ColorDisplay<Ifc> {
type Iter = ColorDisplayDataIter<'a, Ifc>;
}
impl<Ifc> ReadData for ColorDisplay<Ifc> {
fn read<'a>(&'a mut self) -> <Self as HasReadDataIter<&'a mut Self>>::Iter {
ColorDisplayDataIter { ifc: &mut self.ifc }
}
}