Crate protoc_rust
source · [−]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
ArgsDeprecated
Protoc --rust_out...
args
Protoc --rust_out...
args
Specifies style of generated code.
Functions
runDeprecated
Like protoc --rust_out=...
but without requiring protoc-gen-rust
command in $PATH
.