There are several Rust crates to support protobufs, but they all require running code generation during the build.rs stage.
Is it possible to generate protobuf-serialization code without the extra build step? I see two ways:
- using Serde-like approach with the declared structs and possibly some derive or other macros, where the user actually writes out -- this might not work well for arbitrary protobuf serialization because the
.proto
file might not match well with the user-written structs. - using some magical "macro-based inline compiler", where user writes some magical
protobuf!(include_str!("my_protobuf.proto"))
and that generates all the needed code inline, without involving a separate build.rs magic. Is this something not possible at all? Or some negatives to this approach? Or just hasn't been done yet?