I have a trait that is generic: trait Trait<T>
and I want to create another trait that specifies the generics: type Alias = Trait<String>
. This would allow impl Alias for T
and not have to specify the type parameters. I tried a couple ways of doing this and haven't found any that works.
This is not a duplicate of Type alias for multiple traits or Aliasing trait with associated types because doing trait Alias: Trait<T>
requires people to implement Trait<T>
anyway. I want to offer a trait that hides the generics.
A clearer code sample:
trait DefaultEvents = Events<UserStruct, ChannelStruct, IrcStruct>;
struct MyHandler;
impl DefaultEvents for MyHandler {
...
}