#google #protoc #path #input #command-parser #build-dependencies #protobuf-codegen

bin+lib protobuf-codegen-pure3

Pure-rust codegen for protobuf using protobuf-parser crate WIP

4 stable releases

Uses old Rust 2015

2.28.2 Feb 27, 2023
2.28.1 Oct 14, 2022
2.27.3 Sep 7, 2022

#34 in Network programming

Download history 43/week @ 2026-03-09 38/week @ 2026-03-16 60/week @ 2026-03-23 16/week @ 2026-03-30 7/week @ 2026-04-06 17/week @ 2026-04-13 100/week @ 2026-04-20 116/week @ 2026-04-27 112/week @ 2026-05-04 190/week @ 2026-05-11 210/week @ 2026-05-18 225/week @ 2026-05-25 231/week @ 2026-06-01

877 downloads per month

MIT license

165KB
4K SLoC

API to generate .rs files

This API does not require protoc command present in $PATH.

extern crate protoc_rust;

fn main() {
    protobuf_codegen_pure::Codegen::new()
        .out_dir("src/protos")
        .inputs(&["protos/a.proto", "protos/b.proto"])
        .include("protos")
        .run()
        .expect("Codegen failed.");
}

And in Cargo.toml:

[build-dependencies]
protobuf-codegen-pure = "2"

It is advisable that protobuf-codegen-pure build-dependecy version be the same as protobuf dependency.

The alternative is to use protoc-rust crate which uses protoc command for parsing (so it uses the same parser Google is using in their protobuf implementations).

Version 2

This is documentation for version 2 of the crate.

In version 3, this API is moved to protobuf-codegen crate.

Dependencies