[Rust] Add an option to use Rust native enum

Đang mở
#4,177 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@BaldDemian đang làm issue này rồi.

Từ ngày 15/10/2026.

  • #4185 của @BaldDemian — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Java
Star
4.6k
Fork
470
Merge trung bình
9 giờ 28 phút
Pull request đã merge (30 ngày)
33

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/fory

Tất cả issue của apache/fory

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.