1 use crate::compiler_plugin;
2 use crate::gen::code_writer::CodeWriter;
3 
gen_mod_rs(mods: &[String]) -> compiler_plugin::GenResult4 pub(crate) fn gen_mod_rs(mods: &[String]) -> compiler_plugin::GenResult {
5     let v = CodeWriter::with_no_error(|w| {
6         w.comment(&format!("{}generated", "@"));
7         w.write_line("");
8         let mut mods: Vec<&String> = mods.into_iter().collect();
9         mods.sort();
10         for m in mods {
11             w.write_line(&format!("pub mod {};", m));
12         }
13     });
14     compiler_plugin::GenResult {
15         name: "mod.rs".to_owned(),
16         content: v.into_bytes(),
17     }
18 }
19