microsoft / microsoft/stackfuture

Add a way to resize StackFutures

オープン
#6 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Rust
スター
314
フォーク
17
平均マージ
11時間 50分
マージ済み PR(30日)
1

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まずリポジトリの StackFuture の実装と既存のテストを読み、その後、ストレージサイズと ownership がどのように表現されているかを追跡します。提案されている resize API を、成功パスと元の future のエラーパスを含めて評価します。完了条件は、resizing に失敗しない限り、boxing せずにより小さいまたはより大きい StackFuture を安全に試行できることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。