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;
}
Last moify: 2023-10-06 03:46:34
Build time:2025-07-18 09:41:42
Powered By asphinx