Expand description

API to generate .rs files

This API does not require protoc command present in $PATH.

extern crate protoc_rust;

fn main() {
        .inputs(&["protos/a.proto", "protos/b.proto"])
        .expect("Codegen failed.");

And in Cargo.toml:

protobuf-codegen-pure = "2"

It is advisable that protobuf-codegen-pure build-dependecy version be the same as protobuf dependency.

The alternative is to use protoc-rust crate which uses protoc command for parsing (so it uses the same parser Google is using in their protobuf implementations).

Version 2

This is documentation for version 2 of the crate.

In version 3, this API is moved to protobuf-codegen crate.


Arguments for pure rust codegen invocation.
Invoke pure rust codegen. See crate docs for example.
Specifies style of generated code.


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