Open z-jxy opened 4 months ago
Just as I get a feel for your repo I'm writing some test cases and documentation. I would like to know where you are at on parsing additional primitive/non-primitive types for the codegen so that we don't duplicate work :melting_face:
Also in terms of contribution workflow, I'm currently working on my own fork and will send a PR from there. Anything specific you want from that?
@Sir-NoChill Originally I was using serde_json
to deserialize the PklMod
members, so any datatypes that couldn't be represented as json got thrown under this todo.
Since it's not relying on json compatibility now though, I think we could represent some of these types using the type system, like Duration
.
Currently, the codegen feature doesn't provide much flexibility with how the structs are generated. For instance, you can't specify that a struct should derive a specific attribute, like
Debug
,Clone
, or some other custom attribute.As a more robust solution, I wanted to experiment with using a build feature/crate to generate the rust structs from pkl modules as part of the build. This would be similar to how prost-build handles codegen for gRPC. The idea is to run the codegen during build and output it to the target directory, then include the generated file using a macro.
Example use would be something along these lines
helloworld.pkl
:build.rs
:main.rs
:Pros
Cons