GAT(泛型关联类型) 将生命周期引入了关联类型中,语法具体有以下三种:
trait Gat {
type Item<'a>
where
Self: 'a;
type Item2<'b> = &'b str where Self: 'b;
type Iterator<'c>: Iterator<Item = &'c str>
where
Self: 'c;
}
GAT(泛型关联类型) 将生命周期引入了关联类型中,语法具体有以下三种:
trait Gat {
type Item<'a>
where
Self: 'a;
type Item2<'b> = &'b str where Self: 'b;
type Iterator<'c>: Iterator<Item = &'c str>
where
Self: 'c;
}