Crate protoc_rust[][src]

Expand description

API to generate .rs files.

This API requires protoc command present in $PATH or passed explicitly to Codegen object.

extern crate protoc_rust;

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

It is advisable that protoc-rust build-dependecy version be the same as protobuf dependency.

The alternative is to use protobuf-codegen-pure.

Structs

Protoc --rust_out... args

Specifies style of generated code. Generated files can be customized using this proto or using rustproto.proto options.