Protobuf and Service Definitions
Describe your API in proto.
Why gRPC and Protobuf
gRPC is a high-performance RPC framework built on HTTP/2 and Protocol Buffers. In Rust, the tonic crate implements gRPC end to end.
Protobuf is the interface definition language (IDL). You describe messages and services once in a .proto file, and code generators produce strongly typed client and server stubs.
Anatomy of a .proto File
Every proto file declares a syntax version and a package. The package namespaces generated types and avoids collisions.
Use proto3 for tonic. The package name maps to a Rust module path after generation.
syntax = "proto3";
package greeter.v1;All lessons in this course
- Protobuf and Service Definitions
- Generating Code with tonic-build
- Implementing a gRPC Server
- Calling from a gRPC Client