Skip to content

Commit 8f05153

Browse files
committed
Update readme for ttrpc-codegen and compiler
Add version table. Signed-off-by: Tim Zhang <tim@hyper.sh>
1 parent f0e1bec commit 8f05153

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

compiler/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ generate rust version ttrpc code from proto files.
66

77
- [Manual Generation](https://github.com/containerd/ttrpc-rust#1-generate-with-protoc-command) uses ttrpc-compiler as a protoc plugin
88
- [Programmatic Generation](https://github.com/containerd/ttrpc-rust#2-generate-programmatically) uses ttrpc-compiler as a rust crate
9+
10+
## Versions
11+
| ttrpc-compiler version | ttrpc version |
12+
| ------------- | ------------- |
13+
| 0.3.x | <= 0.4.x |
14+
| 0.4.x | >= 0.5.x

ttrpc-codegen/README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
API to generate `.rs` files to be used e. g. [from build.rs](../example/build.rs).
44

5-
Example code:
5+
## Example
6+
7+
build.rs:
68

79
```rust
810
use ttrpc_codegen::Codegen;
9-
use ttrpc_codegen::Customize;
11+
use ttrpc_codegen::{Customize, ProtobufCustomize};
1012

1113
fn main() {
14+
let protos = vec![
15+
"protos/a.proto",
16+
"protos/b.proto",
17+
];
18+
1219
Codegen::new()
1320
.out_dir("protocols/sync")
1421
.inputs(&protos)
@@ -17,19 +24,29 @@ fn main() {
1724
.customize(Customize {
1825
..Default::default()
1926
})
27+
.rust_protobuf_customize(ProtobufCustomize {
28+
..Default::default()
29+
}
2030
.run()
2131
.expect("Gen code failed.");
2232
}
2333

2434
```
2535

26-
And in `Cargo.toml`:
36+
Cargo.toml:
2737

2838
```
2939
[build-dependencies]
30-
ttrpc-codegen = "0.3"
40+
ttrpc-codegen = "0.2"
3141
```
3242

43+
## Versions
44+
| ttrpc-codegen version | ttrpc version |
45+
| ------------- | ------------- |
46+
| 0.1.x | <= 0.4.x |
47+
| 0.2.x | >= 0.5.x |
48+
49+
## Alternative
3350
The alternative is to use
3451
[protoc-rust crate](https://github.com/stepancheg/rust-protobuf/tree/master/protoc-rust),
3552
which relies on `protoc` command to parse descriptors. Both crates should produce the same result,

0 commit comments

Comments
 (0)