public_parent_module

Function public_parent_module 

Source
pub fn public_parent_module(module_name: &str) -> String
Expand description

Extract the public parent module name from a module path.

If the module path contains hidden components (starting with ‘_’), returns the path up to (but not including) the first hidden component. If no hidden components exist, returns the original name.

§Examples

  • "generate_init_py._core""generate_init_py"
  • "pkg._internal.core""pkg"
  • "pkg.mod._hidden""pkg.mod"
  • "pkg.mod""pkg.mod" (unchanged)
  • "_hidden""" (empty, entire module is hidden)