Add grpc-rust documentation: language landing page, quickstart, and route guide (#1511)#1517
Conversation
…oute guide (grpc#1511) Add gRPC Rust Documentation
ejona86
left a comment
There was a problem hiding this comment.
Seems you should have more PR description about when you do want this to go in.
| the repo: | ||
|
|
||
| ```sh | ||
| git clone -b {{< param grpc_vers.rust >}} --depth 1 https://github.com/grpc/grpc-rust |
There was a problem hiding this comment.
The command clones the v0.9.0 tag used for a three year old tonic release. We should use a gRPC specific tag instead.
git clone -b v0.9.0 --depth 1 https://github.com/grpc/grpc-rustThere was a problem hiding this comment.
Oh wow, yes I didn't think of that. I'll go with grpc-v0.9.0
| - **[Protocol buffer][pb] compiler**, `protoc`, [version 34.0][proto34]. | ||
|
|
||
| For installation instructions, see [Protocol Buffer Compiler | ||
| Installation][pbc-install]. Note that because Rust support in `protoc` is not | ||
| yet stable, the version installed must be exactly 34.0. | ||
|
|
||
| - **gRPC-Rust plugin** for the protocol compiler: | ||
|
|
||
| 1. A C++17 compatible compiler and CMake 3.14 or higher are required to | ||
| compile the protobuf code generation tool. | ||
| 2. Follow the detailed instructions on the [`protoc-gen-rust-grpc`][pgrg] page | ||
| to compile and install the plugin. | ||
| 3. Be sure to update your `PATH` so that the `protoc` compiler can find the | ||
| plugin. |
There was a problem hiding this comment.
With the changes in grpc/grpc-rust#2654, users no longer need to manually install protoc or the protoc-gen-rust-grpc plugin and add them to their PATH. Instead, they can simply use the --features grpc-protobuf-build/build-plugin flag to compile them from source. Alternatively, users can edit the Cargo.toml to enable the grpc-protobuf-build/build-plugin feature.
cargo run --bin helloworld-server --features grpc-protobuf-build/build-plugin| ```sh | ||
| protoc --rust_out=src/grpc-helloworld/generated/ --rust_opt=experimental-codegen=enabled,kernel=upb \ | ||
| --rust-grpc_out=src/grpc-helloworld/generated/ --rust-grpc_opt=client_only=true \ | ||
| --proto_path=proto/helloworld/ proto/helloworld/helloworld.proto | ||
| ``` |
There was a problem hiding this comment.
Since we're now using build.rs to generate the code, we can simply run the following:
cargo build --bin grpc-helloworld-clientor
cargo build --bin grpc-helloworld-client --features grpc-protobuf-build/build-plugin| ```sh | ||
| protoc \ | ||
| --rust_out=src/grpc-routeguide/generated/ --rust_opt=experimental-codegen=enabled,kernel=upb \ | ||
| --rust-grpc_out=src/grpc-routeguide/generated/ --rust-grpc_opt=client_only=true \ | ||
| --proto_path=proto/routeguide/ \ | ||
| proto/routeguide/route_guide.proto | ||
| ``` |
There was a problem hiding this comment.
This can be replaced with a cargo build now.
cargo build --bin grpc-routeguide-client
We should also explain the addition of grpc_protobuf_build::CodeGen call the build.rs file.
| changes are made to your proto definitions. However, it requires anyone who | ||
| wants to compile your crate to have `protoc` installed, and the proper C++ | ||
| requirements for building the `protoc-gen-rust-grpc` binary. |
There was a problem hiding this comment.
With the changes from grpc/grpc-rust#2654, the default behaviour is to compile protoc and the plugin from source. This sentence needs to be updated.
dfawley
left a comment
There was a problem hiding this comment.
Updated; thank you for the review
| the repo: | ||
|
|
||
| ```sh | ||
| git clone -b {{< param grpc_vers.rust >}} --depth 1 https://github.com/grpc/grpc-rust |
There was a problem hiding this comment.
Oh wow, yes I didn't think of that. I'll go with grpc-v0.9.0
| - **[Protocol buffer][pb] compiler**, `protoc`, [version 34.0][proto34]. | ||
|
|
||
| For installation instructions, see [Protocol Buffer Compiler | ||
| Installation][pbc-install]. Note that because Rust support in `protoc` is not | ||
| yet stable, the version installed must be exactly 34.0. | ||
|
|
||
| - **gRPC-Rust plugin** for the protocol compiler: | ||
|
|
||
| 1. A C++17 compatible compiler and CMake 3.14 or higher are required to | ||
| compile the protobuf code generation tool. | ||
| 2. Follow the detailed instructions on the [`protoc-gen-rust-grpc`][pgrg] page | ||
| to compile and install the plugin. | ||
| 3. Be sure to update your `PATH` so that the `protoc` compiler can find the | ||
| plugin. |
| ```sh | ||
| protoc \ | ||
| --rust_out=src/grpc-routeguide/generated/ --rust_opt=experimental-codegen=enabled,kernel=upb \ | ||
| --rust-grpc_out=src/grpc-routeguide/generated/ --rust-grpc_opt=client_only=true \ | ||
| --proto_path=proto/routeguide/ \ | ||
| proto/routeguide/route_guide.proto | ||
| ``` |
| changes are made to your proto definitions. However, it requires anyone who | ||
| wants to compile your crate to have `protoc` installed, and the proper C++ | ||
| requirements for building the `protoc-gen-rust-grpc` binary. |
| ```sh | ||
| protoc --rust_out=src/grpc-helloworld/generated/ --rust_opt=experimental-codegen=enabled,kernel=upb \ | ||
| --rust-grpc_out=src/grpc-helloworld/generated/ --rust-grpc_opt=client_only=true \ | ||
| --proto_path=proto/helloworld/ proto/helloworld/helloworld.proto | ||
| ``` |
This is identical to #1511, rolled back in #1516 since we don't want it live yet.