66 stable releases

3.0.0-alpha.2 Nov 1, 2021
2.28.0 Sep 26, 2022
2.27.1 Feb 5, 2022
2.25.2 Oct 24, 2021
1.6.0 May 11, 2018

#761 in Build Utils

Download history 32340/week @ 2025-08-31 36834/week @ 2025-09-07 34049/week @ 2025-09-14 33495/week @ 2025-09-21 38131/week @ 2025-09-28 45124/week @ 2025-10-05 41606/week @ 2025-10-12 44737/week @ 2025-10-19 43554/week @ 2025-10-26 42778/week @ 2025-11-02 39301/week @ 2025-11-09 65859/week @ 2025-11-16 34978/week @ 2025-11-23 41350/week @ 2025-11-30 45882/week @ 2025-12-07 8908/week @ 2025-12-14

162,411 downloads per month
Used in fewer than 26 crates

MIT license

210KB
5K SLoC

API to generate .rs files

API to generate .rs files to be used e. g. from build.rs.

Example code:

With stable rust-protobuf:

extern crate protobuf_codegen_pure;

protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
    out_dir: "src/protos",
    input: &["protos/a.proto", "protos/b.proto"],
    includes: &["protos"],
    customize: protobuf_codegen_pure::Customize {
      ..Default::default()
    },
}).expect("protoc");

With rust-protobuf from master:

extern crate protobuf_codegen_pure;

protobuf_codegen_pure::Args::new()
    .out_dir("src/protos")
    .inputs(&["protos/a.proto", "protos/b.proto"])
    .include("protos")
    .run()
    .expect("protoc");

And in Cargo.toml:

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

The alternative is to use protoc-rust crate, which relies on protoc command to parse descriptors. Both crates should produce the same result, otherwise please file a bug report.

Dependencies

~4–17MB
~208K SLoC