async fn 稳定化async / await ,并且成为 Rust 生态中被广泛使用的重要功能。然而,直到现在,我们仍然无法在 Trait 和 Trait 实现中使用这些能力。Trait 几近沦为语言中的二等公民。这个稳定化 PR 将致力于解决这个问题。#![feature(return_position_impl_trait_in_trait)] (RPITIT) 和 #![feature(async_fn_in_trait)] (AFIT) 趋于稳定,显著增强 Rust 语言和 Trait 的表达能力,支持包括在 Trait 中使用 async fn 等用例。trait Bar {
async fn bar(self);
}
impl Bar for () {
async fn bar(self) {}
}
async fn and return-position impl Trait in trait: https://github.com/rust-lang/rust/pull/115822maud 一个 HTML 模板引擎。duke 为任意二进制类型定义相称的序列化和反序列化能力。t1 一个无依赖的快速 HTML 解析器。lrpar, lrlex, cfgrammar 提供了许多 Yacc 和 Bison 的功能,便于在 Rust 中静态生成解析器。原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。