Set of examples that show off the features provided by tonic.
In order to build these examples, you must have the protoc Protocol Buffers compiler installed, along with the Protocol Buffers resource files.
Ubuntu:
sudo apt update && sudo apt upgrade -y sudo apt install -y protobuf-compiler libprotobuf-dev
Alpine Linux:
sudo apk add protoc protobuf-dev
macOS:
Assuming Homebrew is already installed. (If not, see instructions for installing Homebrew on the Homebrew website.)
brew install protobuf
$ cargo run --bin helloworld-client
$ cargo run --bin helloworld-server
$ cargo run --bin routeguide-client
$ cargo run --bin routeguide-server
$ cargo run --bin authentication-client
$ cargo run --bin authentication-server
$ cargo run --bin load-balance-client
$ cargo run --bin load-balance-server
$ cargo run --bin dynamic-load-balance-client
$ cargo run --bin dynamic-load-balance-server
$ cargo run --bin tls-client
$ cargo run --bin tls-server
$ cargo run --bin health-server
$ cargo run --bin reflection-server
$ cargo run --bin tower-server
systemfd --no-pid -s http::[::1]:50051 -- cargo watch -x 'run --bin autoreload-server'
If you are using the codegen feature, then the following dependencies are required:
The autoload example requires the following crates installed globally:
Both clients and both servers do the same thing, but using the two different approaches. Run one of the servers in one terminal, and then run the clients in another.
ErrorDetails struct$ cargo run --bin richer-error-client
$ cargo run --bin richer-error-client-vec
ErrorDetails struct$ cargo run --bin richer-error-server
$ cargo run --bin richer-error-server-vec