#google #protocol-buffers #path #api #protocol #buffers #generate #implementation #not

build protoc-rust

protoc –rust_out=… available as API. protoc needs to be in $PATH, protoc-gen-run does not.

53 stable releases

2.12.0 Mar 26, 2020
2.10.1 Jan 12, 2020
2.9.0 Sep 30, 2019
2.8.2 Dec 31, 2019
1.4.1 Jun 24, 2017
Download history 6621/week @ 2019-12-10 4086/week @ 2019-12-17 3075/week @ 2019-12-24 4124/week @ 2019-12-31 6603/week @ 2020-01-07 5413/week @ 2020-01-14 5693/week @ 2020-01-21 5912/week @ 2020-01-28 6488/week @ 2020-02-04 6530/week @ 2020-02-11 6319/week @ 2020-02-18 6153/week @ 2020-02-25 6492/week @ 2020-03-03 6642/week @ 2020-03-10 7984/week @ 2020-03-17 7508/week @ 2020-03-24

26,575 downloads per month
Used in 81 crates (33 directly)

MIT license

1.5MB
29K SLoC

API to generate .rs files

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

Example code:

extern crate protoc_rust;

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

And in Cargo.toml:

[build-dependencies]
protoc-rust = "1.5"

Note this API requires protoc command present in $PATH. Although protoc-gen-rust command is not needed.

The alternative is to use pure-rust .proto parser and code generator.

Dependencies

~555KB