Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Api to consume Extensions and import/export all items

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust

調査の方向性

まず Extensions 型と AnyClone 型を読み、次に関連する issue #299 と、提案されている IntoIterator の例を確認してください。すべての拡張項目をエクスポートし、新規または既存の Extensions オブジェクトにインポートするための API の候補を比較してください。プロジェクトが、ネストした typemap の回避策に依存するのではなく、合意済みで利用可能な相互運用性 API を備えた時点で完了とします。

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

説明

When traversing boundaries it's currently quite hard (nearly impossible) to extract all extensions and transfer them to somewhere else. There are some creative ways to work around this, like inserting a nested typemap into extensions, but these are all quite hacky.

Would you be open into some sort of api that can consume extensions and return the individual items, and then later add these back to a new or existing Extension object?

A very quick solution could be something like

impl IntoIterator for Extensions {
    type Item = (TypeId, Box<dyn AnyClone + Send + Sync>);
    type IntoIter = std::vec::IntoIter<Self::Item>;

    fn into_iter(self) -> Self::IntoIter {
        match self.map {
            None => Default::default(),
            Some(map) => {
                map.into_iter().collect::<Vec<_>>().into_iter()
            }
        }
        
    }
}

But it could be anything else, only requirement would be the functionality to export all items from extensions and import them back again. The example implementation also hides away the usage of a hashmap so this detail could be changed in the future if needed. But it does require AnyClone to be public (can be sealed). Please don't focus on this solution too much as I haven't really given it much thought, it's just here as an example / starting point.

I'm really open to all suggestions here on how to support this or what other solutions there might be available. Having extensions be interoperable with other type maps would be really useful and would make extensions much more flexible.

This is slightly related to https://github.com/hyperium/http/issues/299

主要言語
Rust
スター
1.4k
フォーク
378
平均マージ
1日 21時間
マージ済み PR(30日)
5

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

hyperium/http のほかの issue

hyperium/http の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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