Struct mz_protoc::Protoc[][src]

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

A builder for a protobuf compilation.

Implementations

Starts a new compilation.

Adds an include path to the compilation.

Adds an input file to the compilation.

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 crate. Roughly speaking, for each input file path/to/file.proto, this method generates the Rust file OUT_DIR/path/to/file.rs. The details involve some special rules for escaping Rust keywords and special characters, but you will have to consult the protobuf_codegen 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.

  • 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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more