2 releases
new 0.1.1 | Apr 25, 2025 |
---|---|
0.1.0 | Mar 4, 2024 |
#9 in #extend
64 downloads per month
12KB
Tonic-build extend
This is a simple example of how to use extended functions of tonic-build.
Usage
use tonic_build_extend::BuilderExt;
fn main() {
tonic_build::configure()
.out_dir("src/pb")
.types_attributes(
&[
"Struct1",
"Struct2",
],
&[
"#[derive(derive_builder::Builder)]",
"#[builder(setter(into), default)]",
],
)
.fields_attributes(
&["Struct.fieldName1", "Struct.fieldName2"],
&["start", "end"],
&["#[builder(setter(strip_option))]"],
)
.compile(&["./protos/pb.proto"], &["protos"])
.unwrap();
Command::new("cargo")
.args(["fmt"])
.output()
.expect("Failed to run cargo fmt");
}
Dependencies
~0.6–1MB
~24K SLoC