3 ms·
I'd argue it'd make more sense for the keymap macro to load a json/toml/yaml config file and then generate the code but that's just me. Would be a little more s
by unlinked_dll 7y ago
I'd argue it'd make more sense for the keymap macro to load a json/toml/yaml config file and then generate the code but that's just me. Would be a little more straightforward too using serde, just type out your schema in normal rust, automatically derive the deserializer via serde, load a file with a function like macro, and synthesize the C compatible code from there.
- jeffdavis 7y agoTrue, but there's some difficulty using codegen. If macros can do it, it's often nicer. But not always, and it's subjective.
- unlinked_dll 7y agoProcedural macros in Rust are essentially code generators.