[][src]Crate protoc_rust

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

ArgsDeprecated

Protoc --rust_out... args

Codegen

Protoc --rust_out... args

Customize

Specifies style of generated code.

Functions

runDeprecated

Like protoc --rust_out=... but without requiring protoc-gen-rust command in $PATH.

Type Definitions

Error

Alias for io::Error

Result

Alias for io::Error