Skip to main content

generate_module_tree

Function generate_module_tree 

Source
pub fn generate_module_tree<F: AsRef<str>, P: AsRef<str>>(
    entries: &[(F, P)],
    include_mode: IncludeMode<'_>,
    emit_inner_allow: bool,
) -> String
Expand description

Generate a module tree that assembles per-package .mod.rs files into nested pub mod blocks matching the protobuf package hierarchy.

Each entry is a (mod_file_name, package) pair where package is the dot-separated protobuf package name (e.g., "google.api") and mod_file_name is the corresponding <pkg>.mod.rs (only GeneratedFileKind::PackageMod outputs need wiring; per-proto content files are reached via include! from the stitcher).

include_mode controls how include! paths are emitted.

emit_inner_allow adds a #![allow(...)] inner attribute at the top — valid when the output is used directly as a module file (mod.rs), invalid when consumed via include!.