Struct protoc::Protoc[][src]

pub struct Protoc { /* fields omitted */ }
Expand description

A builder for a protobuf compilation.


Starts a new compilation.

Adds an include path to the compilation.

Adds an input file to the compilation.

Enables or disables serde support.

Parses the inputs into a file descriptor set.

A FileDescriptorSet is protobuf’s internal representation of a collection .proto file. It is similar in spirit to an AST, and is useful for callers who will analyze the protobuf messages to provide bespoke deserialization and serialization behavior, rather than relying on the stock code generation.

Most users will want to call Protoc::compile_into or Protoc::build_script_exec instead.

Executes the compilation.

The generated files are placed into out_dir according to the conventions of the protobuf_codegen_pure crate. Roughly speaking, for each input file path/to/file.proto, this method generates the Rust file OUT_DIR/path/to/ The details involve some special rules for escaping Rust keywords and special characters, but you will have to consult the protobuf_codegen_pure source code for details.

Executes the compilation, following build script conventions for input and output.

This is roughly equivalent to calling compile_into, with the following adjustments.

  • The directory to generate into is read from the environment variable OUT_DIR.

  • If an error occurs, instead of returning the error, the error is printed to stderr and the process is aborted.

  • If the compilation is Serde-enabled, Cargo will be instructed to enable the with-serde feature to work around a bug in protobuf_codegen_pure.

  • Various diagnostic information is printed to stdout for users following along with e.g. cargo build -vv.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.