Add a way to resize StackFutures
还没有人认领这个 Issue。
评估
调研方向
首先阅读仓库中的 StackFuture 实现和现有测试,然后跟踪其存储大小和 ownership 的表示方式。评估提议的 resize API,包括成功路径和原始 future 的错误路径;完成的标准是:可以安全地尝试使用更小或更大的 StackFuture,而无需 boxing,除非 resizing 失败。
由索引模型根据 Issue 内容生成。
描述
It'd be helpful to have a way to shrink (or less commonly, grow) a StackFuture. For example, sometimes you have an object that implements a trait and needs to forward calls to another object that implements the same trait. Right now that's impossible with StackFuture without boxing the child future because otherwise you'd have to have a future contain a future that's the same size as itself. That said, there will usually be some extra space so we might be able to dynamically shrink a StackFuture.
The signature would probably be something like:
fn resize<const NEW_SIZE: usize>(self) -> Result<StackFuture<T, NEW_SIZE>, Self>;
Then using this would look something like:
impl Foo for MyObject {
fn bar(&self) -> StackFuture<(), 1000> {
match self.sub_object.bar().resize::<{500}>() {
Ok(f) => f.await,
Err(original) => Box::pin(original).await,
}
}
}
The idea here is we'd try to fit the future into a smaller container, but if it doesn't fit then the resize returns the original future and we can either decide to pay the allocation cost (as we did in this example) or give up.
- 主要语言
- Rust
- 星标
- 314
- 派生
- 17
- 平均合并
- 11 小时 50 分钟
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/stackfuture 的其他 Issue
-
Add benchmarks 未关闭
难度 4/5 3-5 天 新手友好度 35/100
microsoft/stackfuture#8 · 1 个 reaction ·
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
microsoft/stackfuture#5 · 1 条评论 · 5 个 reaction ·
查看 microsoft/stackfuture 的全部 Issue
相似的 Issue
-
risk:low runtime status:in-progress type:test
难度 1/5 1 小时以内 新手友好度 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 84/100
EricSpencer00/Resilient#4835 · 1 条评论 ·
-
agent:ready documentation
难度 2/5 1-3 小时 新手友好度 88/100
cesarferreira/stax#890 ·
-
bug
难度 1/5 1 小时以内 新手友好度 90/100