/// Emits the function section to the output.
///
/// See https://webassembly.github.io/spec/core/binary/modules.html#function-section
Emits the function section to the output.
Emits the function section to the output .
pub fn emit_function_section<O: Write>(
    module: &Module,
    output: &mut O,
) -> Result<usize, EmitError> {
    match module.functions() {
        None => Ok(0),
        Some(functions) => {
            let types: Vec<TypeIndex> = functions.iter().map(Function::kind).collect();
            emit_section(ModuleSection::Function, output, move |o| {
                emit_vector(types.as_slice(), o, emit_u32)
            })
        }
    }
}
pub fn emit_function_section < O : Write > ( module : & Module , output : & mut O , ) -> Result < usize , EmitError > { match module . functions ( ) { None => Ok ( 0 ) , Some ( functions ) => { let types : Vec < TypeIndex > = functions . iter ( ) . map ( Function :: kind ) . collect ( ) ; emit_section ( ModuleSection :: Function , output , move | o | { emit_vector ( types . as_slice ( ) , o , emit_u32 ) } ) } } }
Emits the function section to the output.
Emits the function section to the output .
module
&Module
output
&mut O