Struct tonic_build::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

Service generator builder.

Implementations§

Enable or disable gRPC client code generation.

Enable or disable gRPC server code generation.

Enable or disable generated clients and servers to have built-in tonic transport features.

When the transport feature is disabled this does nothing.

Generate a file containing the encoded prost_types::FileDescriptorSet for protocol buffers modules. This is required for implementing gRPC Server Reflection.

Set the output directory to generate code to.

Defaults to the OUT_DIR environment variable.

Declare externally provided Protobuf package or type.

Passed directly to prost_build::Config.extern_path. Note that both the Protobuf path and the rust package paths should both be fully qualified. i.e. Protobuf paths should start with “.” and rust paths should start with “::”

Add additional attribute to matched messages, enums, and one-offs.

Passed directly to prost_build::Config.field_attribute.

Add additional attribute to matched messages, enums, and one-offs.

Passed directly to prost_build::Config.type_attribute.

Add additional attribute to matched server mods. Matches on the package name.

Add additional attribute to matched service servers. Matches on the service name.

Add additional attribute to matched client mods. Matches on the package name.

Add additional attribute to matched service clients. Matches on the service name.

Set the path to where tonic will search for the Request/Response proto structs live relative to the module where you call include_proto!.

This defaults to super since tonic will generate code in a module.

Configure Prost protoc_args build arguments.

Note: Enabling --experimental_allow_proto3_optional requires protobuf >= 3.12.

Disable service and rpc comments emission.

Emits GRPC endpoints with no attached package. Effectively ignores protofile package declaration from grpc context.

This effectively sets prost’s exported package to an empty string.

Enable or disable directing Prost to compile well-known protobuf types instead of using the already-compiled versions available in the prost-types crate.

This defaults to false.

Configures the optional module filename for easy inclusion of all generated Rust files

If set, generates a file (inside the OUT_DIR or out_dir() as appropriate) which contains a set of pub mod XXX statements combining to load all Rust files generated. This can allow for a shortcut where multiple related proto files have been compiled together resulting in a semi-complex set of includes.

Enable or disable emitting cargo:rerun-if-changed=PATH instructions for Cargo.

If set, writes instructions to stdout for Cargo so that it understands when to rerun the build script. By default, this setting is enabled if the CARGO environment variable is set. The CARGO environment variable is set by Cargo for build scripts. Therefore, this setting should be enabled automatically when run from a build script. However, the method of detection is not completely reliable since the CARGO environment variable can have been set by anything else. If writing the instructions to stdout is undesireable, you can disable this setting explicitly.

Compile the .proto files and execute code generation.

Compile the .proto files and execute code generation using a custom prost_build::Config.

Turn the builder into a ServiceGenerator ready to be passed to prost-builds Config::service_generator.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.