more readme cleanup
This commit is contained in:
@@ -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`]
|
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.
|
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`
|
`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:
|
feature. To install the beta simply follow the commands below:
|
||||||
@@ -48,6 +46,20 @@ $ rustup component add rustfmt --toolchain beta
|
|||||||
$ cargo +beta build
|
$ cargo +beta build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Helloworld</summary>
|
||||||
|
|
||||||
|
#### `Cargo.toml`
|
||||||
|
|
||||||
|
```toml
|
||||||
|
tonic = "*"
|
||||||
|
bytes = "0.4"
|
||||||
|
prost = "0.5"
|
||||||
|
prost-derive = "0.5"
|
||||||
|
```
|
||||||
|
|
||||||
#### Protobuf
|
#### Protobuf
|
||||||
|
|
||||||
```protobuf
|
```protobuf
|
||||||
@@ -70,6 +82,14 @@ message HelloReply {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `build.rs`
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn main() {
|
||||||
|
tonic_build::compile_protos("proto/helloworld/helloworld.proto").unwrap();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Client
|
#### Client
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
@@ -146,6 +166,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
First, see if the answer to your question can be found in the API documentation.
|
First, see if the answer to your question can be found in the API documentation.
|
||||||
|
|||||||
Reference in New Issue
Block a user