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

#168 in #protobuf

Download history 38459/week @ 2022-10-17 33287/week @ 2022-10-24 33212/week @ 2022-10-31 31569/week @ 2022-11-07 29489/week @ 2022-11-14 30763/week @ 2022-11-21 29227/week @ 2022-11-28 30593/week @ 2022-12-05 31929/week @ 2022-12-12 27015/week @ 2022-12-19 20635/week @ 2022-12-26 26391/week @ 2023-01-02 31514/week @ 2023-01-09 26558/week @ 2023-01-16 25271/week @ 2023-01-23 27010/week @ 2023-01-30

113,657 downloads per month
Used in fewer than 35 crates

MIT license

1.5MB
35K 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