1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
pub trait Trait<Foo> { type Item; fn f() -> Foo; fn f2() -> Self::Item; } pub struct Foo; pub struct Bar; pub struct Item; impl Trait<Foo> for Bar { type Item = Item; fn f() -> Foo { Foo } fn f2() -> Self::Item { Item } }