Closed

Description
We can add an option to the variant
attribute to achieve this. The API may look something like:
#[derive(ToVariant, FromVariant)]
#[variant(enum = "i64")]
enum Foo {
A = 1,
B = 2,
}
#[derive(ToVariant, FromVariant)]
#[variant(enum = "str")]
enum Bar {
A,
B,
}
...where Foo
is converted to and from i64
values equal to the discriminant, and Bar
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.