Skip to main content

generate_python_protobuf

Function generate_python_protobuf 

Source
pub fn generate_python_protobuf(
    schema: &ProtobufSchema,
    target: &ProtobufTarget,
) -> Result<String>
Expand description

Generate Python Protobuf code from a schema

Parses the Protobuf schema and generates complete Python code with message definitions, service clients, and server stubs based on the target specification.

§Arguments

  • schema - Parsed Protobuf schema
  • target - Generation target specifying what to generate:
    • ProtobufTarget::All - Complete code: messages, services, and utilities
    • ProtobufTarget::Messages - Message definitions only
    • ProtobufTarget::Services - Service clients and stubs only

§Returns

Generated Python code as a String, or an anyhow::Error if generation fails.