more readme cleanup

This commit is contained in:
Lucio Franco
2019-10-01 16:45:13 -04:00
parent 3c1b2e4bb5
commit e02e814cee
+25 -3
View File
@@ -35,9 +35,7 @@ contains the tools to build clients and servers from [`protobuf`] definitions.
Examples can be found in [`tonic-examples`] and for more complex scenarios [`tonic-interop`]
may be a good resource as it shows examples of many of the gRPC features.
### Examples
#### Rust Version
### Rust Version
`tonic` currently works on rust `1.39-beta` and above as it requires support for the `async_await`
feature. To install the beta simply follow the commands below:
@@ -48,6 +46,20 @@ $ rustup component add rustfmt --toolchain beta
$ cargo +beta build
```
### Examples
<details>
<summary>Helloworld</summary>
#### `Cargo.toml`
```toml
tonic = "*"
bytes = "0.4"
prost = "0.5"
prost-derive = "0.5"
```
#### Protobuf
```protobuf
@@ -70,6 +82,14 @@ message HelloReply {
}
```
#### `build.rs`
```rust
fn main() {
tonic_build::compile_protos("proto/helloworld/helloworld.proto").unwrap();
}
```
#### Client
```rust
@@ -146,6 +166,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```
</details>
## Getting Help
First, see if the answer to your question can be found in the API documentation.