/// An `Iterator`-like trait that can borrow from `Self`
trait LendingIterator {
type Item<'a> where Self: 'a;
fn next<'a>(&'a mut self) -> Option<Self::Item<'a>>;
}
/// Can be implemented over smart pointers, like `Rc` or `Arc`,
/// in order to allow being generic over the pointer type
trait PointerFamily {
type Pointer<T>: Deref<Target = T>;
fn new<T>(value: T) -> Self::Pointer<T>;
}
/// Allows borrowing an array of items. Useful for
/// `NdArray`-like types that don't necessarily store
/// data contiguously.
trait BorrowArray<T> {
type Array<'x, const N: usize> where Self: 'x;
fn borrow_array<'a, const N: usize>(&'a self) -> Self::Array<'a, N>;
}
Rust 1.65.0 稳定版发布,泛型关联类型 (GATs) 正式稳定
Rust 1.65.0 稳定版已发布。此版本包含多项重要的语法变更,以及编辑器和标准库方面的改动。值得关注的是,Rust 1.65 现在还启用了 MIR 内联来优化编译,为 crate 提供了 3-10% 的编译时间改进。
语言特性
#[non_exhaustive]变体进行as转换添加错误处理let else正式稳定Lifetime、type 和 const 泛型现在可以在关联类型上进行定义,如下所示:
下面是一些使用示例:
let_underscore_drop,let_underscore_lock和let_underscore_must_useDropimpl编译器
-Csplit-debuginfo正式稳定special_module_namelint-C instrument-coverage时,增加对默认生成唯一的 profraw 文件的支持标准库
PartialEq::neBCRYPT_RNG_ALG_HANDLESystem与 direct system allocator 调用混合使用详情查看 Release Note 和发布公告。