ZON field value extractor (for the lack of better name) - zon_get_fields

This is a big update, kinda, so I thought I’d give the thread a bump. Hope it’s not inappropriate.

Anyway, I’ve added a completely new way of getting values from the ZON text - you can now throw (a pointer to) your struct and an AST at this new function - pub fn zonToStruct, and thanks to Zig comptime magic (mutually recursive comptime calls… my head nearly exploded), it comes out all filled with values!

Well, at least if the AST contains the values for your struct fields. When there’s no match, the field is not modified, and I couldn’t figure out a way to report this back to the caller, which is a bummer :frowning_face:

2 Likes