I am working on a actor project which need alias for the trait because it is so long, but even with the nightly feature #![feature(trait_alias)] seems can not achieve.
In short I write a playground:
I want alias A<T> to be shorter causing I have many generic type on A in real case; and the same time I want to access the type Output = Self; from its implementations B.
Appreciate for any help.
#![feature(trait_alias)]
trait A<T> {
type Output;
fn test(a: T) -> Self::Output;
}
//To alias the trait, real situation longer than this.
//attempt 1:
trait B: A<String>{}
//attempt 2:
//trait B : A<String, Output=Self> where Self: std::marker::Sized {}
//impl<T> B for T where T: A<String, Output=T> {}
//attempt 3 with trait_alias:
//trait B = A<String>;
struct SA;
impl B for SA {
type Output = Self;
}