[Rust] Add an option to use Rust native enum

Aperta
#4,177 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@BaldDemian ci sta già lavorando.

Dal 15/10/2026.

  • #4185 di @BaldDemian — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend

Direzione di ricerca

The issue concerns the #[ForyUnon] attribute on Rust enums and the rule that picks the xlang union representation when a variant has 2+ fields. Start by finding where that attribute and the field-count check are handled in the Rust derive code, and decide how a user-facing option should select the native enum instead. Done means a user can choose native enum output explicitly, without an Unknown variant, with the choice covered by tests. The design of the option's name and behaviour should be agreed with maintainers first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Feature Request

#[ForyUnon] enum T { .. } can be

  1. Xlang union, which requires me to add Unknown variant
  2. Rust native enum, which does not require me to Unknown variant

The problem is that there is no way to tell Fory to use 2.
It's automatically decided by the existence of a variant with 2+ fields.

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Lingua principale
Java
Stelle
4.6k
Fork
470
Merge medio
9h 28m
PR unite (30g)
33

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/fory

Tutte le issue di apache/fory

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.