Rust 2024 Edition 中 async fn in trait 的生命周期推导规则
在 Rust 2024 中,Trait 声明中的 async fn 默认隐式捕获所有输入参数的生命周期。
trait Fetcher {
// 编译器自动展开为: impl Future<Output = String> + use<'a, Self>
async fn fetch<'a>(&'a self, key: &'a str) -> String;
}当需要显式切断生命周期关联时,可以使用 + use<..> 精确捕获声明。