-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to derive Variant conversion to and from primitives for fieldless enums #546
Closed
Tracked by
#958
Milestone
Comments
ghost
added
feature
Adds functionality to the library
c: export
Component: export (mod export, derive)
labels
Jul 23, 2020
ghost
added this to the
0.9.1 milestone
Jul 23, 2020
ghost
removed this from the 0.9.2 milestone
Dec 28, 2020
ghost
added this to the 0.10 milestone
Feb 3, 2021
As mentioned in the discord. I'm going to take a look at working on this issue. |
chitoyuu
added a commit
to chitoyuu/godot-rust
that referenced
this issue
Oct 18, 2022
Adds the `#[variant(enum = "repr")]` and `#[variant(enum = "str")]` item-level attribute to the Variant conversion derive macros for fieldless enums. - `#[variant(enum = "repr")]` - convert through the numeric type specified using `#[repr]`. - `#[variant(enum = "str")]` - convert through string representations of the variant names. WIP - do not merge! FromVariant implementations would conflict with godot-rust#962. Close godot-rust#546.
chitoyuu
added a commit
to chitoyuu/godot-rust
that referenced
this issue
Oct 18, 2022
Adds the `#[variant(enum = "repr")]` and `#[variant(enum = "str")]` item-level attribute to the Variant conversion derive macros for fieldless enums. - `#[variant(enum = "repr")]` - convert through the numeric type specified using `#[repr]`. - `#[variant(enum = "str")]` - convert through string representations of the variant names. WIP - do not merge! FromVariant implementations would conflict with godot-rust#962. Close godot-rust#546.
chitoyuu
added a commit
to chitoyuu/godot-rust
that referenced
this issue
Oct 18, 2022
Adds the `#[variant(enum = "repr")]` and `#[variant(enum = "str")]` item-level attribute to the Variant conversion derive macros for fieldless enums. - `#[variant(enum = "repr")]` - convert through the numeric type specified using `#[repr]`. - `#[variant(enum = "str")]` - convert through string representations of the variant names. WIP - do not merge! FromVariant implementations would conflict with godot-rust#962. Close godot-rust#546.
chitoyuu
added a commit
to chitoyuu/godot-rust
that referenced
this issue
Oct 19, 2022
Adds the `#[variant(enum = "repr")]` and `#[variant(enum = "str")]` item-level attribute to the Variant conversion derive macros for fieldless enums. - `#[variant(enum = "repr")]` - convert through the numeric type specified using `#[repr]`. - `#[variant(enum = "str")]` - convert through string representations of the variant names. Close godot-rust#546.
bors bot
added a commit
that referenced
this issue
Oct 19, 2022
964: Derive stringly and numeric ToVariant for fieldless enums r=Bromeon a=chitoyuu Adds the `#[variant(enum = "repr")]` and `#[variant(enum = "str")]` item-level attribute to the Variant conversion derive macros for fieldless enums. - `#[variant(enum = "repr")]` - convert through the numeric type specified using `#[repr]`. - `#[variant(enum = "str")]` - convert through string representations of the variant names. Close #546. Co-authored-by: Chitose Yuuzaki <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We can add an option to the
variant
attribute to achieve this. The API may look something like:...where
Foo
is converted to and fromi64
values equal to the discriminant, andBar
is converted to and from strings representing the variant names.Optionally, we might also add a derive macro for
Export
for these types that automatically generates the appropriate hints.See also: #544.
The text was updated successfully, but these errors were encountered: