pub(super) fn generate_module_definitions<'i>(
    modules: impl ExactSizeIterator<Item = &'i Module<'i>>,
    linked_modules: &'i LinkedModules<'_>,
) -> TResult<Vec<TokenStream>> {
    modules
        .into_iter()
        .map(|value| {
            // linked_modules are built from modules, so unwrap is safe
            let content = generate_module_definition(
                value,
                linked_modules.get(&value.name).unwrap(),
                module_import_generator,
            )?;
            let module_ident = new_ident(value.name)?;
            Ok(quote! {
                pub mod #module_ident {
                    #content
                }
            })
        })
        .collect::<TResult<Vec<_>>>()
}
/// Generates definitions of modules and records of this modules.
/// F.e. for the greeting service the following definitions would be generated:
///```ignore
/// pub mod __m_generated_greeting {
///     struct MGeneratedStructgreeting {
///         marine: std::rc::Rc<std::cell::RefCell<marine_rs_sdk_test::internal::AppService>>,
///     }
///
///     impl MGeneratedStructgreeting {
///         pub fn new(marine: std::rc::Rc<std::cell::RefCell<marine_rs_sdk_test::internal::AppService>>) -> Self {
///             Self { marine }
///         }
///
///         pub fn greeting(&mut self, name: String) -> String {
///             use std::ops::DerefMut;
///             let arguments = marine_rs_sdk_test::internal::serde_json::json!([name]);
///             let result = self
///                 .marine
///                 .as_ref
///                 .borrow_mut()
///                 .call_with_module_name("greeting", "greeting", arguments, <_>::default())
///                 .expect("call to Marine failed");
///             let result: String = marine_rs_sdk_test::internal::serde_json::from_value(result)
///                 .expect("the default deserializer shouldn't fail");
///             result
///         }
///     }
/// }
///```
Generates definitions of modules and records of this modules.




Generates definitions of modules and records of this modules .
pub(super) fn generate_module_definitions<'i>(
    modules: impl ExactSizeIterator<Item = &'i Module<'i>>,
    linked_modules: &'i LinkedModules<'_>,
) -> TResult<Vec<TokenStream>> {
    modules
        .into_iter()
        .map(|value| {
            // linked_modules are built from modules, so unwrap is safe
            let content = generate_module_definition(
                value,
                linked_modules.get(&value.name).unwrap(),
                module_import_generator,
            )?;
            let module_ident = new_ident(value.name)?;
            Ok(quote! {
                pub mod #module_ident {
                    #content
                }
            })
        })
        .collect::<TResult<Vec<_>>>()
}
pub ( super ) fn generate_module_definitions < ' i > ( modules : impl ExactSizeIterator < Item = & ' i Module < ' i > > , linked_modules : & ' i LinkedModules < ' _ > , ) -> TResult < Vec < TokenStream > > { modules . into_iter ( ) . map ( | value | { // linked_modules are built from modules, so unwrap is safe let content = generate_module_definition ( value , linked_modules . get ( & value . name ) . unwrap ( ) , module_import_generator , ) ? ; let module_ident = new_ident ( value . name ) ? ; Ok ( quote ! { pub mod module_ident { content } } ) } ) . collect :: < TResult < Vec < _ > > > ( ) }
Generates definitions of modules and records of this modules.
Generates definitions of modules and records of this modules .
modules
impl ExactSizeIterator<Item = &'i Module<'i>>
linked_modules
&'i LinkedModules<'_>