[Rust] Add an option to use Rust native enum

Abierto
#4,177 1 comentario 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@BaldDemian ya está trabajando en esto.

Desde el 15/10/2026.

  • #4185 de @BaldDemian — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Java
Estrellas
4.6k
Forks
470
Merge medio
9 h 28 min
PR fusionados (30 d)
33

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/fory

Todos los issues de apache/fory

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.