| Crates.io | ttrpc-codegen |
| lib.rs | ttrpc-codegen |
| version | 0.6.0 |
| created_at | 2020-07-20 07:11:05.028956+00 |
| updated_at | 2025-07-15 03:24:23.305572+00 |
| description | Rust codegen for ttrpc using ttrpc-compiler crate |
| homepage | https://github.com/containerd/ttrpc-rust/tree/master/ttrpc-codegen |
| repository | https://github.com/containerd/ttrpc-rust/tree/master/ttrpc-codegen |
| max_upload_size | |
| id | 267132 |
| size | 125,057 |
API to generate .rs files to be used e. g. from build.rs.
build.rs:
use ttrpc_codegen::Codegen;
use ttrpc_codegen::{Customize, ProtobufCustomize};
fn main() {
let protos = vec![
"protos/a.proto",
"protos/b.proto",
];
Codegen::new()
.out_dir("protocols/sync")
.inputs(&protos)
.include("protocols/protos")
.rust_protobuf()
.customize(Customize {
..Default::default()
})
.rust_protobuf_customize(ProtobufCustomize {
..Default::default()
}
.run()
.expect("Gen code failed.");
}
Cargo.toml:
[build-dependencies]
ttrpc-codegen = "0.2"
| ttrpc-codegen version | ttrpc version |
|---|---|
| 0.1.x | <= 0.4.x |
| 0.2.x | == 0.5.x |
| 0.3.x | == 0.6.x |
| 0.4.x | >= 0.7.x |
| 0.5.x | >= 0.7.x |
The alternative is to use
protoc-rust crate,
which relies on protoc command to parse descriptors. Both crates should produce the same result,
otherwise please file a bug report.