为什么这里需要关联类型,即使它从未使用过?
trait Tr {
type Ty;
fn go(&self) -> () {}
}
fn foo(t: dyn Tr) -> () {
t.go()
}
我明白了
2 | type Ty;
| -------- `Ty` defined here
...
6 | fn foo(t: dyn Tr) -> () {
| ^^^^^^ associated type `Ty` must be specified