orga icon indicating copy to clipboard operation
orga copied to clipboard

derive(State) for enums

Open mappum opened this issue 5 years ago • 2 comments

We can support enums as State types by storing a byte to mark the variant at the root key, and using that to instantiate the enum variant (each variant's fields must implement State).

The only questions are how to map variant fields to keys (we want to share data between variant transitions without copying) and how to transition between variants (maybe the author can create transitions with impl From<VariantContentsA> for VariantContentsB, although we will have to somehow delete the data for dropped fields).

mappum avatar Apr 29 '20 04:04 mappum

This depends on figuring out a good state composability pattern, as is the goal in #26.

mappum avatar Feb 19 '21 19:02 mappum

This also applies to derive(Query).

mappum avatar Sep 07 '21 19:09 mappum