Holochain Forum

New How To Wiki Article: How To Write An Entry Struct with an Enum Field That Serializes Nicely (Serde Msgpack)

Figuring out the serialization and deserialization patterns across the Zome/WASM boundary with your client side code can be tricky, so here’s a solution to a perhaps common “gotcha”.

If folks have improvements suggestions please let me know.

3 Likes

Wow, the amount of boilerplate is daunting.
Have you tried using strum?

Thanks for sharing.

I guess a next possible step in reducing the boilerplate is to write a macro and make the code available somehow for re-use.

Have you been using strum, will it play nicely with serde in the context of Holochain? Is it a possible solution to this?

I use strum in my dna but not directly on dna entries so I don’t how it behaves with serde. But strum is supposedly the defacto solution for having enum behave as strings, so I believe its worth exploring this path.

1 Like