pub struct Builder { /* private fields */ }
Expand description
A mirror of tonic_build::Builder
for our own control
Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Self
pub fn force(self, force: bool) -> Self
Sourcepub fn follow_links(self, follow_links: bool) -> Self
pub fn follow_links(self, follow_links: bool) -> Self
Follow symbolic links when finding .proto files.
This defaults to false
.
pub fn out_dir(self, out_dir: impl AsRef<Path>) -> Self
Sourcepub fn default_module_name(self, name: impl AsRef<str>) -> Self
pub fn default_module_name(self, name: impl AsRef<str>) -> Self
Configures what filename protobufs with no package definition are written to.
Sourcepub fn build_client(self, enable: bool) -> Self
pub fn build_client(self, enable: bool) -> Self
Enable or disable gRPC client code generation.
Sourcepub fn build_server(self, enable: bool) -> Self
pub fn build_server(self, enable: bool) -> Self
Enable or disable gRPC server code generation.
Sourcepub fn extern_path(
self,
proto_path: impl AsRef<str>,
rust_path: impl AsRef<str>,
) -> Self
pub fn extern_path( self, proto_path: impl AsRef<str>, rust_path: impl AsRef<str>, ) -> Self
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 “::”
Sourcepub fn field_attribute<P: AsRef<str>, A: AsRef<str>>(
self,
path: P,
attribute: A,
) -> Self
pub fn field_attribute<P: AsRef<str>, A: AsRef<str>>( self, path: P, attribute: A, ) -> Self
Add additional attribute to matched messages, enums, and one-offs.
Passed directly to prost_build::Config.field_attribute
.
Sourcepub fn type_attribute<P: AsRef<str>, A: AsRef<str>>(
self,
path: P,
attribute: A,
) -> Self
pub fn type_attribute<P: AsRef<str>, A: AsRef<str>>( self, path: P, attribute: A, ) -> Self
Add additional attribute to matched messages, enums, and one-offs.
Passed directly to prost_build::Config.type_attribute
.
Sourcepub fn server_mod_attribute<P: AsRef<str>, A: AsRef<str>>(
self,
path: P,
attribute: A,
) -> Self
pub fn server_mod_attribute<P: AsRef<str>, A: AsRef<str>>( self, path: P, attribute: A, ) -> Self
Add additional attribute to matched server mod
s. Matches on the package name.
Sourcepub fn server_attribute<P: AsRef<str>, A: AsRef<str>>(
self,
path: P,
attribute: A,
) -> Self
pub fn server_attribute<P: AsRef<str>, A: AsRef<str>>( self, path: P, attribute: A, ) -> Self
Add additional attribute to matched service servers. Matches on the service name.
Sourcepub fn client_mod_attribute<P: AsRef<str>, A: AsRef<str>>(
self,
path: P,
attribute: A,
) -> Self
pub fn client_mod_attribute<P: AsRef<str>, A: AsRef<str>>( self, path: P, attribute: A, ) -> Self
Add additional attribute to matched client mod
s. Matches on the package name.
Sourcepub fn client_attribute<P: AsRef<str>, A: AsRef<str>>(
self,
path: P,
attribute: A,
) -> Self
pub fn client_attribute<P: AsRef<str>, A: AsRef<str>>( self, path: P, attribute: A, ) -> Self
Add additional attribute to matched service clients. Matches on the service name.
Sourcepub fn protoc_arg<A: AsRef<str>>(self, arg: A) -> Self
pub fn protoc_arg<A: AsRef<str>>(self, arg: A) -> Self
Configure Prost protoc_args
build arguments.
Note: Enabling --experimental_allow_proto3_optional
requires protobuf >= 3.12.
Sourcepub fn compile_well_known_types(self, compile_well_known_types: bool) -> Self
pub fn compile_well_known_types(self, compile_well_known_types: bool) -> Self
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
.
Sourcepub fn include_file(self, path: impl AsRef<Path>) -> Self
pub fn include_file(self, path: impl AsRef<Path>) -> Self
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.
Sourcepub fn file_descriptor_set_path(self, path: impl Into<PathBuf>) -> Self
pub fn file_descriptor_set_path(self, path: impl Into<PathBuf>) -> Self
When set, the FileDescriptorSet
generated by protoc is written to the provided filesystem path.
This option can be used in conjunction with the include_bytes!
macro and the types in the prost-types
crate
for implementing reflection capabilities, among other things.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more