Struct protobuf_codegen::Customize
source · pub struct Customize { /* private fields */ }
Expand description
Specifies style of generated code.
Generated files can be customized using this proto
or using rustproto.proto
options.
Implementations§
source§impl Customize
impl Customize
sourcepub fn before(self, before: &str) -> Self
pub fn before(self, before: &str) -> Self
Insert code before the element in the generated file (e. g. serde annotations, see example here).
pub fn generate_accessors(self, generate_accessors: bool) -> Self
pub fn generate_getter(self, generate_getter: bool) -> Self
pub fn tokio_bytes(self, tokio_bytes: bool) -> Self
pub fn tokio_bytes_for_string(self, tokio_bytes_for_string: bool) -> Self
sourcepub fn lite_runtime(self, lite_runtime: bool) -> Self
pub fn lite_runtime(self, lite_runtime: bool) -> Self
Generate code for “lite runtime”. Generated code contains no code for reflection. So the generated code (and more importantly, generated binary size) is smaller, but reflection, text format, JSON serialization won’t work.
Note when using protoc
plugin protoc-gen-rust
, the option name is just lite
.
sourcepub fn gen_mod_rs(self, gen_mod_rs: bool) -> Self
pub fn gen_mod_rs(self, gen_mod_rs: bool) -> Self
Generate mod.rs
with all the generated modules.
This option is on by default in rust-protobuf version 3.
sourcepub fn inside_protobuf(self, inside_protobuf: bool) -> Self
pub fn inside_protobuf(self, inside_protobuf: bool) -> Self
Generate code bundled in protobuf crate. Regular users don’t need this option.
sourcepub fn update_with(&mut self, that: &Customize)
pub fn update_with(&mut self, that: &Customize)
Update fields of self with fields defined in other customize
sourcepub fn set_defaults_from(&mut self, other: &Customize)
pub fn set_defaults_from(&mut self, other: &Customize)
Update unset fields of self with fields from other customize
sourcepub fn parse_from_parameter(parameter: &str) -> Result<Customize>
pub fn parse_from_parameter(parameter: &str) -> Result<Customize>
Parse customize options from a string passed via protoc flag.