Skip to main content

generate_models_mod

Function generate_models_mod 

Source
pub fn generate_models_mod(
    services: &[ServicePlan],
    include_labels: bool,
    include_pyo3_impls: bool,
    metadata: &CodeGenMetadata,
    runtime: Runtime,
) -> String
Expand description

Generate the mod.rs for crates/common/src/models/.

Emits pub mod <service> { pub mod <version> { include!("./<pkg>.rs") } } blocks for every service in the plan, plus static re-exports and module declarations. The model files are co-located in this directory (written by the buf plugin), so the includes are plain sibling references.

When include_labels is true, also emits pub mod labels; pub use labels::{ObjectLabel, Resource};.

metadata is used to discover all resource-annotated messages (even those not returned directly by an RPC) so they can be included in pub use re-exports.