Open Lorak-mmk opened 7 months ago
The main question is how to specify the type to serialize to (i32, u8 etc)?
We could require that it be specified as a derive macro's attribute, e.g.:
#[derive(SerializeCql)]
#[enum_repr(i32)]
enum MyEnum {
A = 0,
B = 1,
}
Part of #962.
This looks like it can be a common case that users want to use structs like in this forum question: https://forum.scylladb.com/t/can-we-make-an-enum-serializable-so-it-can-go-to-and-from-a-cqlvalue-in-rust/1242 While I don't see any sensible way to derive for arbitrary enums, we could add support for enums without data. I think this shouldn't be too hard. The main question is how to specify the type to serialize to (i32, u8 etc)?