Skip to main content

generate_file

Function generate_file 

Source
pub fn generate_file(
    dir: &Path,
    mod_name: &str,
    kind: &str,
    content: &str,
    export: Option<&str>,
) -> Result<()>
Expand description

Writes {dir}/{mod_name}.rs (must not already exist) and registers it in {dir}/mod.rs as pub mod {mod_name};, plus pub use {mod_name}::{export}; when export is Some - a struct name for controllers/models/requests, a function name for middleware. None for a file with nothing nameable to re-export (a policy’s trait impl block is globally visible once compiled in; no re-export needed).