pub fn emit_reference_instruction<O: Write + ?Sized>(
    instruction: &ReferenceInstruction,
    output: &mut O,
) -> Result<usize, EmitError> {
    let mut bytes = 0;

    match instruction {
        ReferenceInstruction::Null(kind) => {
            bytes += emit_byte(0xD0u8, output)?;
            bytes += emit_reference_type(*kind, output)?;
        }
        ReferenceInstruction::IsNull => {
            bytes += emit_byte(0xD1u8, output)?;
        }
        ReferenceInstruction::Function(index) => {
            bytes += emit_byte(0xD2u8, output)?;
            bytes += emit_u32(index, output)?;
        }
    }

    Ok(bytes)
}
/// Emit a reference instruction to the output.
///
/// See https://webassembly.github.io/spec/core/binary/instructions.html#reference-instructions
Emit a reference instruction to the output.
Emit a reference instruction to the output .
pub fn emit_reference_instruction<O: Write + ?Sized>(
    instruction: &ReferenceInstruction,
    output: &mut O,
) -> Result<usize, EmitError> {
    let mut bytes = 0;
    match instruction {
        ReferenceInstruction::Null(kind) => {
            bytes += emit_byte(0xD0u8, output)?;
            bytes += emit_reference_type(*kind, output)?;
        }
        ReferenceInstruction::IsNull => {
            bytes += emit_byte(0xD1u8, output)?;
        }
        ReferenceInstruction::Function(index) => {
            bytes += emit_byte(0xD2u8, output)?;
            bytes += emit_u32(index, output)?;
        }
    }
    Ok(bytes)
}
pub fn emit_reference_instruction < O : Write + ? Sized > ( instruction : & ReferenceInstruction , output : & mut O , ) -> Result < usize , EmitError > { let mut bytes = 0 ; match instruction { ReferenceInstruction :: Null ( kind ) => { bytes += emit_byte ( 0xD0u8 , output ) ? ; bytes += emit_reference_type ( * kind , output ) ? ; } ReferenceInstruction :: IsNull => { bytes += emit_byte ( 0xD1u8 , output ) ? ; } ReferenceInstruction :: Function ( index ) => { bytes += emit_byte ( 0xD2u8 , output ) ? ; bytes += emit_u32 ( index , output ) ? ; } } Ok ( bytes ) }
Emit a reference instruction to the output.
Emit a reference instruction to the output .
instruction
&ReferenceInstruction
output
&mut O
instruction
&ReferenceInstruction
output
&mut O