From 3b8692be55c9c751c2ac3a655a63c63b61af0dcc Mon Sep 17 00:00:00 2001 From: tamasfe Date: Wed, 27 Jul 2022 23:55:36 +0200 Subject: [PATCH] fix(def): conditional compilation and doc fixes --- src/api/definitions/mod.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/api/definitions/mod.rs b/src/api/definitions/mod.rs index 583ecba0..a1d14be0 100644 --- a/src/api/definitions/mod.rs +++ b/src/api/definitions/mod.rs @@ -109,7 +109,7 @@ impl<'e> Definitions<'e> { /// Output all definitions merged into a single file. /// - /// The directory must exist but the file will be created or overwritten as needed. + /// The parent directory must exist but the file will be created or overwritten as needed. #[cfg(all(not(feature = "no_std"), not(target_family = "wasm")))] pub fn write_to_file(&self, path: impl AsRef) -> std::io::Result<()> { std::fs::write(path, self.single_file()) @@ -131,14 +131,17 @@ impl<'e> Definitions<'e> { def_file += &self.static_module_impl(&config); def_file += "\n"; - for (module_name, module_def) in self.modules_impl(&config) { - write!( - &mut def_file, - "module {module_name} {{\n\n{module_def}\n}}\n" - ) - .unwrap(); + #[cfg(not(feature = "no_module"))] + { + for (module_name, module_def) in self.modules_impl(&config) { + write!( + &mut def_file, + "module {module_name} {{\n\n{module_def}\n}}\n" + ) + .unwrap(); + } + def_file += "\n"; } - def_file += "\n"; def_file += &self.scope_impl(&config);