Function burst::x86::format_instruction_string [] [src]

pub fn format_instruction_string(
    stream: &mut Write,
    fmt: &str,
    opcode: Option<&[u8]>,
    addr: usize,
    instr: &X86Instruction
) -> Result

Write an Instruction to a stream.

The fmt string can contain these specifiers:

In the future, this may be replaced by something that is more like the std::fmt features of the Rust standard library.

This currently doesn't support any configurable syntax support for AT&T style syntax.

use burst::x86::*;

let data = [0u8, 0u8];
if let Ok(instr) = disassemble_64(&data, 0, data.len()) {
    let mut out = String::new();
    format_instruction_string(&mut out, "%a %b %i %o", Some(&data), 0, &instr);
    assert_eq!("0000000000000000 0000 add byte [rax], al", out);
}