prost
A Protocol Buffers implementation for Rust that generates simple, idiomatic types via derive macros.
Repository Health
Technical Analysis
Prost is a Protocol Buffers implementation for the Rust language, generating clean, idiomatic Rust code directly from proto2 and proto3 .proto files. Rather than emitting large generated modules full of boilerplate, Prost leans on Rust’s derive-macro system so .proto messages become plain structs annotated with #[derive(Message)], oneofs become enums, and comments from the source .proto files are preserved in the generated docs.
Maintained under the Tokio project umbrella, Prost is the de facto Protobuf implementation for the Rust ecosystem and is the code-generation layer beneath gRPC libraries like tonic. It supports no_std environments, preserves unknown enum values on deserialization (important for forward-compatible wire formats), and uses the bytes crate’s Buf/BufMut abstractions instead of std::io::{Read, Write} for zero-copy-friendly encoding and decoding.
What You Get
- The
prostruntime crate:Message,Enumeration, andOneofderive macros plus theMessagetrait (encode,decode,encoded_len, and buffer-based variants) for any type annotated with#[derive(Message)] prost-build, a build-script library that invokesprotoc(or a pure-Rustprotoc-free path) to compile.protofiles into Rust modules duringcargo buildprost-types, ready-made Rust bindings for the Protobuf well-known types (Any,Timestamp,Duration,Struct, etc.)- Preservation of
.protocomments as Rust doc comments on generated types, plus package-to-module mapping (package foo.barbecomes thefoo::barRust module) no_stdsupport (disable thestdfeature) so Prost can be used in embedded and constrained environments- A
BTreeMapconfiguration option inprost-buildfor deterministic, allocation-conscious map encoding instead ofHashMap
Common Use Cases
- Generating Rust request/response types for gRPC services when paired with
tonicas the RPC transport - Encoding/decoding a stable, versioned wire format for cross-service or cross-language communication (Rust services talking to Go, Java, Python, or C++ peers over Protobuf)
- Persisting structured records in a compact binary format for storage or message-queue payloads where JSON’s size and stringliness are undesirable
- Building
no_stdfirmware or embedded systems that need a compact, cross-language-compatible message format without pulling instd - Emitting a
FileDescriptorSetfor runtime introspection tooling that needs the original.protoschema shape alongside generated code
Under The Hood
Architecture: The workspace splits cleanly along a build-time/runtime boundary. prost-build (a separate crate invoked from a consuming project’s build.rs) shells out to protoc to parse .proto files into a FileDescriptorSet, then walks that descriptor tree to emit Rust source implementing the Message trait for each message type. At runtime, the prost crate itself is deliberately small: src/message.rs defines the core Message trait (encode_raw, merge_field, encoded_len, plus default-provided encode/decode/encode_to_vec methods), src/encoding.rs (1,462 lines) implements the actual varint/length-delimited wire encoding for every Protobuf scalar and collection shape via macro-generated encode/merge/encoded_len function families, and src/types.rs plus the separate prost-types crate supply the well-known-type bindings. prost-derive is the proc-macro crate that reads struct/enum field attributes (emitted by prost-build) and generates the actual Message/Enumeration/Oneof trait implementations, closing the loop between build-time codegen and runtime behavior. Tech Stack: Pure Rust workspace (Cargo.toml lists prost, prost-build, prost-derive, prost-types, plus dedicated tests, tests-2015/2018/2024, and tests-no-std crates for edition and no_std compatibility matrices). The only runtime dependency of the core prost crate is bytes (for Buf/BufMut); prost-derive is an optional dependency gated behind the derive feature (on by default). MSRV is pinned at Rust 1.85 with a documented six-month rolling policy. Dev-dependencies include criterion for benchmarking varint encoding and proptest/rand for property-based testing. Code Quality: The crate carries a dedicated tests workspace member (with prost-path, reexported-prost, and single-include sub-crates) exercising re-export and path-independence scenarios, alongside edition-specific test crates (tests-2015, tests-2018, tests-2024) and a tests-no-std crate proving the no_std feature actually compiles without std. A fuzz/ directory plus FUZZING.md and KANI.md document both libFuzzer-based fuzz targets and formal verification via the Kani model checker — an unusually rigorous quality bar for a serialization library where malformed input handling is a real attack surface. DecodeError in src/error.rs tracks a ‘best effort’ error description plus a (message, field) name stack for nested decode failures, giving actionable error context rather than an opaque failure. CI (.github/workflows/ci.yml, cifuzz.yml) runs the full matrix on every push. API Design: The public surface centers on one trait (Message) and three derive macros, keeping the mental model small: annotate a struct, call .encode()/Message::decode(). Scalar-to-Rust-type mapping (int32 to i32, bytes to Vec<u8>, etc.) follows Rust conventions rather than inventing new wrapper types, and generated oneofs become plain Rust enums matched with match. The tradeoff for this simplicity is that some internal-use methods (encode_raw, merge_field) are #[doc(hidden)] but technically public, and the README explicitly flags a deprecated DecodeError::new that leaked into public API by accident — an honest, documented rough edge rather than a silent trap.
Used by 10 apps in this directory
Anarlog
Note Taking · AI Assistants · Productivity
Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.
Fluree DB
Databases
A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
Laminar
AI Development · Monitoring
Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.
mesh-llm
AI Development · AI Agents
Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.
codex
AI Code Assistants · Developer Tools
OpenAI's open-source CLI coding agent that reads, edits, and runs code in your terminal using natural language prompts.
OpenShell
AI Agents · Developer Tools
The safe, private runtime that lets autonomous AI agents operate in sandboxed environments governed by declarative YAML policies — blocking data exfiltration, credential leaks, and unauthorized network activity before they happen.
ParadeDB
Search · Databases · Analytics
Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.
PeerDB
Data Engineering · Databases
Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.