pub struct CodegenOptions {Show 14 fields
pub generate_docs: bool,
pub generate_default: bool,
pub generate_deprecated: bool,
pub btree_map: bool,
pub use_btree_map: bool,
pub package_namespacing: bool,
pub type_attributes: BTreeMap<String, Vec<String>>,
pub field_attributes: BTreeMap<String, Vec<String>>,
pub emit_oxi_message_impl: bool,
pub format_output: bool,
pub emit_services: bool,
pub emit_json: bool,
pub emit_builder: bool,
pub emit_text_format: bool,
}Expand description
Options controlling code generation from a FileDescriptorSet.
Fields§
§generate_docs: boolGenerate doc comments from proto source info (default: true)
generate_default: boolGenerate Default impls for enums (default: true)
generate_deprecated: boolUse #[deprecated] for deprecated fields/messages/enums (default: true)
btree_map: boolUse BTreeMap for proto map fields instead of HashMap (default: false)
use_btree_map: boolAlias for btree_map kept for backward compat with existing tests
package_namespacing: boolEmit pub mod hierarchy matching the proto package structure (default: true).
When false, all types are emitted flat (no module nesting).
type_attributes: BTreeMap<String, Vec<String>>Per-type custom attributes. Key: fully-qualified proto type name.
Value: list of attribute strings (e.g., ["#[derive(serde::Serialize)]"]).
field_attributes: BTreeMap<String, Vec<String>>Per-field custom attributes. Key: “TypeName.field_name”. Value: list of attribute strings.
emit_oxi_message_impl: boolEmit impl OxiMessage for T + impl OxiName for T blocks (default: false).
Requires oxiproto-core as a dependency of the crate using generated code.
format_output: boolUse prettyplease to format generated code (requires format feature).
emit_services: boolEmit pub trait … service definitions (default: true).
Set to false to suppress service-trait emission (e.g. --grpc=false in the CLI).
emit_json: boolEmit self-contained to_json/from_json methods on generated types
(canonical Protobuf-JSON mapping). Requires serde_json and base64
in the consumer crate. Default: false.
emit_builder: boolEmit a FooBuilder struct with fluent setters for each message (default: false).
emit_text_format: boolEmit a to_text_format() -> String method on each generated message struct (default: false).
Implementations§
Source§impl CodegenOptions
impl CodegenOptions
Sourcepub fn use_btree_map_effective(&self) -> bool
pub fn use_btree_map_effective(&self) -> bool
Returns true if BTreeMap should be used for map fields.
Trait Implementations§
Source§impl Clone for CodegenOptions
impl Clone for CodegenOptions
Source§fn clone(&self) -> CodegenOptions
fn clone(&self) -> CodegenOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more