Skip to main content

generate

Function generate 

Source
pub fn generate(request: &CodeGeneratorRequest) -> Result<CodeGeneratorResponse>
Expand description

Generate a CodeGeneratorResponse from a protoc CodeGeneratorRequest.

This is the entry point for the protoc plugin (protoc-gen-connect-rust). It parses the comma-separated request.parameter into Options and delegates to generate_services — service stubs only. Callers must run protoc-gen-buffa (or equivalent) separately for message types.

§Recognized options

  • buffa_module=<rust_path> — where you mounted the buffa-generated module tree (e.g. buffa_module=crate::proto). Shorthand for extern_path=.=<rust_path>. This is the option most local users want.
  • extern_path=<proto>=<rust> — map a specific proto package prefix to a Rust module path. Repeatable; longest-prefix-match wins. extern_path=.=<path> is the catch-all (equivalent to buffa_module). At least one catch-all mapping is required so every type resolves.
  • strict_utf8_mapping — see Options::strict_utf8_mapping.
  • no_json — disable serde derives on generated message types. Ignored in this plugin (no message types emitted); accepted for compatibility with the unified path.