Skip to main content

generate_nested_file

Function generate_nested_file 

Source
pub fn generate_nested_file(
    root: &Path,
    path_segments: &[String],
    mod_name: &str,
    kind: &str,
    content: &str,
    export: Option<&str>,
) -> Result<()>
Expand description

The nested-directory equivalent of generate_file: writes {root}/{path_segments.join("/")}/{mod_name}.rs, creating every intermediate directory and wiring each one’s own mod.rs (pub mod {next_segment};, chained from root’s own mod.rs down) along the way - for a converted structure whose Laravel source used real subdirectories (App\Livewire\Pages\Webservices\Compare) rather than a flat namespace, so the generated output can mirror that instead of flattening it into one prefixed filename. path_segments empty is equivalent to calling generate_file directly.