Skip to content

Commit

Permalink
Use prost instead of rust-protobuf
Browse files Browse the repository at this point in the history
Main differences:

- use `::default` instead of `::new` to create instances
- use native field accessors
- use native Option and Vec types for optional and repeated fields
- dispatcher struct has a more qualified name
- gRPC generator code is encapsulated in a prost ServiceGenerator
- use `quote!` macros instead of string concatenation in the generator
  • Loading branch information
tiziano88 committed Apr 8, 2020
1 parent ec30827 commit 193ae98
Show file tree
Hide file tree
Showing 104 changed files with 600 additions and 14,607 deletions.
113 changes: 20 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,3 @@ split_grpc_proxy = { path = "experimental/split_grpc/proxy" }
split_grpc_server = { path = "experimental/split_grpc/server" }
# Third party.
expect = { path = "third_party/expect" }
grpc-compiler = { path = "third_party/grpc-rust/grpc-compiler" }
protoc-rust-grpc = { path = "third_party/grpc-rust/protoc-rust-grpc" }
2 changes: 1 addition & 1 deletion docs/programming-oak.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ generated file appearing in `src/proto/<service>_grpc.rs`.
[embedmd]:# (../examples/hello_world/module/rust/build.rs Rust /fn main/ /^}/)
```Rust
fn main() {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
oak_utils::compile_protobuf_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/hello_world.proto"],
includes: &["../../proto", "../../../../third_party"],
Expand Down
3 changes: 1 addition & 2 deletions examples/abitest/module_0/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ hex = "*"
log = "*"
oak = "=0.1.0"
oak_abi = "=0.1.0"
protobuf = "*"
prost = "*"
rand_core = "*"
rand = "*"
regex = "*"
Expand All @@ -24,4 +24,3 @@ serde_json = "*"

[build-dependencies]
oak_utils = "*"
protoc-rust-grpc = { path = "../../../../third_party/grpc-rust/protoc-rust-grpc" }
12 changes: 4 additions & 8 deletions examples/abitest/module_0/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
//

fn main() {
oak_utils::run_protoc_rust_grpc(protoc_rust_grpc::Args {
out_dir: "src/proto",
input: &["../../proto/abitest.proto"],
includes: &["../../proto", "../../../../third_party"],
rust_protobuf: true, // also generate protobuf messages, not just services
..Default::default()
})
.expect("protoc-rust-grpc");
oak_utils::compile_protobuf(
&["../../proto/abitest.proto"],
&["../../proto", "../../../../third_party"],
);
}
Loading

0 comments on commit 193ae98

Please sign in to comment.