Skip to main content

generate_models_mod

Function generate_models_mod 

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

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

Emits pub mod <service> { pub mod <version> { include!(...) } } blocks for every service in the plan, plus static re-exports and module declarations.

gen_dir is the relative path (from the subdir) to the prost-generated files, e.g. "../gen".

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.