Existing syntax allows us to write a default value for associated type:
trait Foo {
type Bar = i32;
}
I want something like C++:
trait Foo {
typedef int Bar;
}
This is not valid Rust code, but tries to show my intention:
trait Foo<T> {
trait Trait = Into<T> + /* 10 other traits dependent on T */;
fn foo(x: Type) -> Trait;
}
T
and then you try to treat it as a trait because you add other traits to it (+ Clone
). Those two concepts aren't compatible. – Unschooled