API to generate .rs
files to be used e. g. from build.rs.
Example code:
With stable rust-protobuf:
```rust extern crate protobufcodegenpure;
protobufcodegenpure::run(protobufcodegenpure::Args { outdir: "src/protos", input: &["protos/a.proto", "protos/b.proto"], includes: &["protos"], customize: protobufcodegen_pure::Customize { ..Default::default() }, }).expect("protoc"); ```
With rust-protobuf from master:
```rust extern crate protobufcodegenpure;
protobufcodegenpure::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.