Crate protoc_rust

Source
Expand description

§API to generate .rs files using protoc to parse files

This API requires protoc command present in $PATH or explicitly passed to Codegen object (but protoc plugin is not needed).

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.");
}

and in build.rs:

[build-dependencies]
protoc-rust = "2"

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

The alternative is to use protobuf-codegen-pure crate.

§Protoc binary

This crate searches for protoc binary in $PATH by default.

protoc binary can be obtained using protoc-bin-vendored crate and supplied to Codegen object.

§This is version 2

In branch 3 of rust-protobuf this functionality is provided by protobuf-codegen crate.

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.

Type Aliases§

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy