Generate WIT, not Rust source code
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rust, wasm
調査の方向性
まず、cargo component new が使用する実装とテンプレートを特定し、src/bindings.rs、src/bindings.wit、Cargo.toml が現在どのように扱われているかを比較します。WIT の管理と wit_bindgen::generate! の呼び出しを中心に移行を定義します。生成されたプロジェクトがこのモデルに従い、cargo-component 自体が Rust バインディングを生成しない状態を完了とします。
索引モデルが issue の本文から書いたものです。
説明
Currently, to the best of my knowledge, cargo component generates a src/bindings.rs file using a version of wit-bindgen baked directly into the executable cargo-component itself. Running cargo component new generates a project that depends on wit-bindgen-rt at a matching version of what cargo-component has baked in to itself.
This is problematic to the development of wit-bindgen, unfortunately, because the generated code using wit-bindgen 0.A.0 generally requires wit-bindgen-rt 0.A.0 as well, and you can't mix and match versions. Mismatched versions can arise relatively easily with cargo-component in two situations:
- An older project might update to using a newer
cargo-componentexecutable, meaning that theCargo.tomldepends on an olderwit-bindgen-rtwhile the executable generates bindings with a newerwit-bindgenversion. - An older project might update
wit-bindgen-rtbut fail to updatecargo-component, producing the inverse problem where an olderwit-bindgenis used with a newerwit-bindgen-rt.
This is coming up as I'm doing refactoring in wit-bindgen and shuffling things around, and ideally I'd prefer to not break cargo component users because at this time if anything is added to wit-bindgen-rt then users will break.
As an alternative, what I might recommend is to instead have cargo component manage WIT, not generated source code. The basic idea is that cargo component would generate-and-manage src/bindings.wit instead of src/bindings.rs. The template for cargo component new would add a dependency on wit-bindgen but critically wouldn't actually generate any code. For example the generated file might look like:
wit_bindgen::generate!("./src/bindings.wit");
fn main() {
println!("hello!");
}
This should be more idiomatic in terms of wit-bindgen usage where it's "just" a call to the generate! macro with various options. The key difference is that the input *.wit is completely managed by cargo component and handles things like dependencies and such which wit-bindgen otherwise doesn't do.
My hope is that this wouldn't break things like IDE integration workflows as they in theory already need to work with procedural macros. The upside though is that the cargo component executable wouldn't even need to depend on wit-bindgen itself because it doesn't generate any Rust code. Instead it only generates a reference to wit-bindgen and then a macro invocation. The WIT management all remains in cargo component, however.
This would additionally solve the problem of updating/changing wit-bindgen as, after inception, it's a per-project decision of when to update wit-bindgen which is orthogonal from using cargo component as a build tool.
- 主要言語
- Rust
- スター
- 593
- フォーク
- 68
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/cargo-component のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
bytecodealliance/cargo-component#399 · コメント 2 件 ·
bytecodealliance/cargo-component の issue をすべて見る
似ている issue
-
[Bug] AM Context Monitor (am-monitor): Session turns count is capped at 80 due to turns.slice(-80)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
lbjlaq/Antigravity-Manager#4180 ·
メンテナーはふだん 1 日以内に返信
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zizmorcore/zizmor#2608 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
longbridge/nsh#4201 ·
メンテナーはふだん 1 日以内に返信