Define a .proto schema for a gRPC service and use prost-build to auto-generate the Rust message types in your build script.
Serialize and deserialize structured data between Rust microservices using the compact protobuf binary encoding.
Integrate protobuf message types into a Tokio-based async Rust project without a separate runtime reflection library.
Replace manual struct definitions for network protocol messages with auto-generated, type-safe Rust code from .proto files.
Requires adding prost-build as a build dependency and writing a build.rs script.proto file compilation happens automatically at build time.
Prost is a Rust library that implements Protocol Buffers, a format for efficiently encoding structured data so it can be sent between programs or stored compactly. Protocol Buffers, often called protobuf, were originally developed at Google and are widely used in networked systems and APIs where performance and compact encoding matter. You define your data structures in a special schema file with a .proto extension, and a code generator reads that file and produces ready-to-use code in your chosen programming language. Prost handles the Rust side of that process. You write your schema files, and prost generates plain Rust structs and enums that match your definitions. The generated types are ordinary Rust code, using standard Rust features like derive macros rather than introducing a separate class hierarchy or requiring a runtime library to introspect your types. The README notes that prost does not support runtime reflection, which is a deliberate tradeoff in favor of keeping generated code simple and lightweight. The companion crate prost-build integrates the code generation step into Rust's build system, so the .proto files are compiled automatically when you build your project. The README walks through how different protobuf field types map to Rust types (for example, a protobuf string becomes a Rust String, a repeated field becomes a Vec, and an optional message field becomes an Option), and how protobuf packages map to Rust modules. The project lives under the tokio-rs organization on GitHub, which is the team behind the Tokio asynchronous runtime for Rust. Prost is described as passively maintained, meaning it accepts contributions and fixes bugs but is not under active feature development. It supports Rust version 1.82 and above, following the same minimum version policy as the Tokio project.
← tokio-rs on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.