rust - "where for"在 Rust 中意味着什么?

标签 rust

这个SO answer使用我不熟悉的 where 语法:

fn readfile<'a, T: ?Sized>(filename: &str) -> Result<Box<Outer<'a, T>>, Box<std::error::Error>>
where
    for<'de> T: Deserialize<'de> + 'a
{
   ...

for 是什么意思?

这是在哪里记录的?

最佳答案

这就是所谓的higher-ranked trait bounds :

for<'a> can be read as "for all choices of 'a"

它由 Rust RFC 0387 定义.

关于rust - "where for"在 Rust 中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57647276/

相关文章:

functional-programming - 在 map 内部使用 if 时如何处理 "if may be missing an else clause"?

rust - 如何在函数中借用 "take"切片的第一部分?

rust - 为什么在使用特征时参数类型必须是 'static

rust - Rust 如何从正在运行的程序中检索输入的 argc 和 argv 值?

json - 根据用户角色返回 JSON

rust - 如何在不使用 Tokio 同时运行相同功能的情况下以重复间隔同时运行一组功能?

unit-testing - 为什么我不能运行 main() 中定义的#[test]?

file - 写入带有 rust 迹的文件时会写入多余的行

algorithm - Rust 中是否有等同于 C++ std::copy 的东西?

rust - 是否有可能在 U 和 V 上有一个通用的结构,其中 U : V?