/// Emit a module to the output.
///
/// See https://webassembly.github.io/spec/core/binary/modules.html
Emit a module to the output.
Emit a module to the output .
pub fn emit_module<O: Write>(module: &Module, output: &mut O) -> Result<usize, EmitError> {
    let mut bytes = 0;
    bytes += emit_bytes(&PREAMBLE, output, false)?;
    bytes += emit_bytes(&VERSION, output, false)?;
    bytes += emit_custom_sections(module, ModuleSection::Custom, output)?;
    bytes += emit_type_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Type, output)?;
    bytes += emit_import_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Import, output)?;
    bytes += emit_function_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Function, output)?;
    bytes += emit_table_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Table, output)?;
    bytes += emit_memory_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Memory, output)?;
    bytes += emit_global_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Global, output)?;
    bytes += emit_export_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Export, output)?;
    bytes += emit_start_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Start, output)?;
    bytes += emit_element_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Element, output)?;
    bytes += emit_data_count_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::DataCount, output)?;
    bytes += emit_code_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Code, output)?;
    bytes += emit_data_section(module, output)?;
    bytes += emit_custom_sections(module, ModuleSection::Data, output)?;
    Ok(bytes)
}
pub fn emit_module < O : Write > ( module : & Module , output : & mut O ) -> Result < usize , EmitError > { let mut bytes = 0 ; bytes += emit_bytes ( & PREAMBLE , output , false ) ? ; bytes += emit_bytes ( & VERSION , output , false ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Custom , output ) ? ; bytes += emit_type_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Type , output ) ? ; bytes += emit_import_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Import , output ) ? ; bytes += emit_function_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Function , output ) ? ; bytes += emit_table_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Table , output ) ? ; bytes += emit_memory_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Memory , output ) ? ; bytes += emit_global_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Global , output ) ? ; bytes += emit_export_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Export , output ) ? ; bytes += emit_start_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Start , output ) ? ; bytes += emit_element_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Element , output ) ? ; bytes += emit_data_count_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: DataCount , output ) ? ; bytes += emit_code_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Code , output ) ? ; bytes += emit_data_section ( module , output ) ? ; bytes += emit_custom_sections ( module , ModuleSection :: Data , output ) ? ; Ok ( bytes ) }
Emit a module to the output.
Emit a module to the output .
module
&Module
output
&mut O