pub fn generate_rust(compilation_unit: &CompilationUnit) -> TokenStream {
    let names = generate_names(compilation_unit);
    let mut tokens = Vec::new();

    let required_imports =
        native_types_we_need_to_import(&names, compilation_unit);

    if !required_imports.is_empty() {
        let using_statements = quote! {
            use ::protodef_core::native::{ #(#required_imports),* };
        };
        tokens.push(using_statements);
    };

    let type_definitions = compilation_unit
        .types
        .iter()
        .map(|(id, ty)| generate_type_definition(*id, ty, &names));

    tokens.extend(type_definitions);

    tokens.into_iter().collect()
}
/// Generate Rust bindings for the types in a particular [`CompilationUnit`].
Generate Rust bindings for the types in a particular [`CompilationUnit`].
Generate Rust bindings for the types in a particular [ ` CompilationUnit ` ] .
pub fn generate_rust(compilation_unit: &CompilationUnit) -> TokenStream {
    let names = generate_names(compilation_unit);
    let mut tokens = Vec::new();
    let required_imports =
        native_types_we_need_to_import(&names, compilation_unit);
    if !required_imports.is_empty() {
        let using_statements = quote! {
            use ::protodef_core::native::{ #(#required_imports),* };
        };
        tokens.push(using_statements);
    };
    let type_definitions = compilation_unit
        .types
        .iter()
        .map(|(id, ty)| generate_type_definition(*id, ty, &names));
    tokens.extend(type_definitions);
    tokens.into_iter().collect()
}
pub fn generate_rust ( compilation_unit : & CompilationUnit ) -> TokenStream { let names = generate_names ( compilation_unit ) ; let mut tokens = Vec :: new ( ) ; let required_imports = native_types_we_need_to_import ( & names , compilation_unit ) ; if ! required_imports . is_empty ( ) { let using_statements = quote ! { use protodef_core native { ( required_imports ) } } ; tokens . push ( using_statements ) ; } ; let type_definitions = compilation_unit . types . iter ( ) . map ( | ( id , ty ) | generate_type_definition ( * id , ty , & names ) ) ; tokens . extend ( type_definitions ) ; tokens . into_iter ( ) . collect ( ) }
Generate Rust bindings for the types in a particular [`CompilationUnit`].
Generate Rust bindings for the types in a particular [ ` CompilationUnit ` ] .
compilation_unit
&CompilationUnit