← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 303.a.3.c · 生成模型:GPT-6

汇总结果保留输入顺序

理解等级:中级

结果索引按输入排列,任务实际完成时间可以不同。顺序等待已启动任务与顺序执行未启动 Future 有不同吞吐行为,且阻塞式 block_on 应放在适合阻塞的调用端。关联 [[任务承载Future]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第03章《Chapter 3. Building Our Own Async Queues》,收集结果与启动工作的区别(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch03.html#id80) - 结论依据:自制宏将句柄结果按实参顺序写入 Vec,并要求输出类型一致。 - 原始内容:It is essential that we keep the order of the results the same as the order of the futures passed in. Otherwise, the user will have no way of knowing which result belongs to which task. Also note that our join macro will return only one type, so we use our join macro as follows: