Expand description
pb-jelly-gen
generates Rust bindings for proto
files. It’s intended to be used with pb-jelly
.
§Examples
Complete examples can be found in the examples
crate,
or the pb-test
crate of the pb-jelly
workspace.
§In a nutshell 🥜
You can include pb-jelly-gen
in your Cargo project, by including it as a [build-dependency]
in your Cargo.toml
[build-dependencies]
pb-jelly-gen = "0.0.17"
Then from a build.rs
script, use either the GenProtos
builder struct,
or the gen_protos
convience function to specify where your protos live, and where the generated code should be
put.
use pb_jelly_gen::GenProtos;
fn main() -> Result<(), Box<dyn std::error::Error>> {
GenProtos::builder()
// output path for our generated code
.out_path("./gen")
// directory where our protos live
.src_path("./protos")
// delete and recreate the `out_path` directory every time
.cleanup_out_path(true)
.gen_protos()?;
Ok(())
}
Modules§
Structs§
- GenProtos
- A builder struct to configure the way your protos are generated, create one with
GenProtos::builder()
Functions§
- gen_
protos - A “no frills” way to generate Rust bindings for your proto files.
src_paths
is a list of paths to your.proto
files, or the directories that contain them. Generated code it outputted to<current crate's manifest>/gen
.