pub struct Builder { /* private fields */ }Expand description
Configuration builder for prost-validate code generation.
Builder::new()
.compile_protos(&["path/to/protobuf.proto"], &["path/to/include"])
.unwrap();Implementations§
source§impl Builder
impl Builder
sourcepub fn file_descriptor_set_path<P>(&mut self, path: P) -> &mut Self
pub fn file_descriptor_set_path<P>(&mut self, path: P) -> &mut Self
Set the path where the encoded file descriptor set is created.
By default, it is created at $OUT_DIR/file_descriptor_set.bin.
This overrides the path specified by
prost_build::Config::file_descriptor_set_path.
sourcepub fn configure(
&mut self,
config: &mut Config,
protos: &[impl AsRef<Path>],
includes: &[impl AsRef<Path>],
) -> Result<()>
pub fn configure( &mut self, config: &mut Config, protos: &[impl AsRef<Path>], includes: &[impl AsRef<Path>], ) -> Result<()>
Configure config to derive [prost_validate::Validator] for all messages included in protos.
This method does not generate prost-validate compatible code,
but config may be used later to compile protocol buffers independently of Builder.
protos and includes should be the same when prost_build::Config::compile_protos is called on config.
ⓘ
let mut config = Config::new();
// Customize config here
Builder::new()
.configure(&mut config, &["path/to/protobuf.proto"], &["path/to/include"])
.expect("Failed to configure for reflection");
// Custom compilation process with `config`
config.compile_protos(&["path/to/protobuf.proto"], &["path/to/includes"])
.expect("Failed to compile protocol buffers");pub fn configure_with_file_descriptor_protos( &mut self, config: &mut Config, protos: &[FileDescriptorProto], ) -> Result<()>
sourcepub fn compile_protos_with_config(
&mut self,
config: Config,
protos: &[impl AsRef<Path>],
includes: &[impl AsRef<Path>],
) -> Result<()>
pub fn compile_protos_with_config( &mut self, config: Config, protos: &[impl AsRef<Path>], includes: &[impl AsRef<Path>], ) -> Result<()>
Compile protocol buffers into Rust with given prost_build::Config.
sourcepub fn compile_protos(
&mut self,
protos: &[impl AsRef<Path>],
includes: &[impl AsRef<Path>],
) -> Result<()>
pub fn compile_protos( &mut self, protos: &[impl AsRef<Path>], includes: &[impl AsRef<Path>], ) -> Result<()>
Compile protocol buffers into Rust.
pub fn annotate(&self, config: &mut Config, descriptor: &DescriptorPool)
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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>
Converts
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>
Converts
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