[Rust] custom derive for struct/enum with resource types

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

まず Rust の custom-derive の処理と、リソース型が additional-derive-ignore とどのように相互作用するかを追跡します。Issue にある 3 つのアプローチを比較し、どの動作を選択すべきか、またリソース型を含む struct と enum でそれをどのように検証できるかを判断します。

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

説明

gen-rust

Currently custom derive applies to all struct and enum definitions. Understandably, the resource struct doesn't use the custom derive. The problem is that when the struct/enum type contains a resource type, the derive trait will not work. We can use additional-derive-ignore to opt-out such types individually, but that's not very convenient.

I can see several ways to fix it, but not sure which one makes more sense:

  1. Only apply custom derive to struct and enum that doesn't contain resource types. This is equivalent to manually opt-out those types with additional-derive-ignore.
  2. Apply the custom derive to resource struct as well. But many traits don't make sense for resource types.
  3. Have a flag to define custom derive for individual types, similar to with, we can have a with-derive.

Maybe in the short term, we can apply the first option, which is also easy to implement?

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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

bytecodealliance/wit-bindgen のほかの issue

bytecodealliance/wit-bindgen の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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