I am working with some generic structs like the following:
pub struct Example<A, B, C, D, E, F> {
inner: OtherExample<A, B, C, D, E, F>
...
}
and throughout implementing methods of this struct, I have to keep referring to that huge set of types like so:
impl<A, B, C, D, E, F> Example<A, B, C, D, E, F> {
pub fn get_inner(&self) -> &OtherExample<A, B, C, D, E, F> {
&self.inner
}
...
}
and I'm wondering if there is a way to shorten up the notation on all these generic types. For the sake of readability, I can't just use single letters like I have in the examples above, so I would really want to create a generic type alias in the struct like so:
pub struct Example<AliasedGenerics = <A, B, C, D, E, F>> {
inner: OtherExample<AliasedGenerics>
...
}
impl<AliasedGenerics = <A, B, C, D, E, F>> Example<AliasedGenerics> {
pub fn get_inner(&self) -> &OtherExample<AliasedGenerics> {
&self.inner
}
...
}
So that I don't have to keep writing extremely long lines and improve the readability of the generic implementation.