pub trait FormatterOutput {
    // Required method
    fn write(&mut self, text: &str, kind: FormatterTextKind);

    // Provided methods
    fn write_prefix(
        &mut self,
        instruction: &Instruction,
        text: &str,
        prefix: PrefixKind
    ) { ... }
    fn write_mnemonic(&mut self, instruction: &Instruction, text: &str) { ... }
    fn write_number(
        &mut self,
        instruction: &Instruction,
        operand: u32,
        instruction_operand: Option<u32>,
        text: &str,
        value: u64,
        number_kind: NumberKind,
        kind: FormatterTextKind
    ) { ... }
    fn write_decorator(
        &mut self,
        instruction: &Instruction,
        operand: u32,
        instruction_operand: Option<u32>,
        text: &str,
        decorator: DecoratorKind
    ) { ... }
    fn write_register(
        &mut self,
        instruction: &Instruction,
        operand: u32,
        instruction_operand: Option<u32>,
        text: &str,
        register: Register
    ) { ... }
    fn write_symbol(
        &mut self,
        instruction: &Instruction,
        operand: u32,
        instruction_operand: Option<u32>,
        address: u64,
        symbol: &SymbolResult<'_>
    ) { ... }
}
Expand description

Used by a Formatter to write all text. String also implements this trait.

The only method that must be implemented is write(), all other methods call it if they’re not overridden.

Required Methods§

source

fn write(&mut self, text: &str, kind: FormatterTextKind)

Writes text and text kind

Arguments
  • text: Text
  • kind: Text kind

Provided Methods§

source

fn write_prefix( &mut self, instruction: &Instruction, text: &str, prefix: PrefixKind )

Writes a prefix

Arguments
  • instruction: Instruction
  • text: Prefix text
  • prefix: Prefix
source

fn write_mnemonic(&mut self, instruction: &Instruction, text: &str)

Writes a mnemonic (see Instruction::mnemonic())

  • instruction: Instruction
  • text: Mnemonic text
source

fn write_number( &mut self, instruction: &Instruction, operand: u32, instruction_operand: Option<u32>, text: &str, value: u64, number_kind: NumberKind, kind: FormatterTextKind )

Writes a number

Arguments
  • instruction: Instruction
  • operand: Operand number, 0-based. This is a formatter operand and isn’t necessarily the same as an instruction operand.
  • instruction_operand: Instruction operand number, 0-based, or None if it’s an operand created by the formatter.
  • text: Number text
  • value: Value
  • number_kind: Number kind
  • kind: Text kind
source

fn write_decorator( &mut self, instruction: &Instruction, operand: u32, instruction_operand: Option<u32>, text: &str, decorator: DecoratorKind )

Writes a decorator

Arguments
  • instruction: Instruction
  • operand: Operand number, 0-based. This is a formatter operand and isn’t necessarily the same as an instruction operand.
  • instruction_operand: Instruction operand number, 0-based, or None if it’s an operand created by the formatter.
  • text: Decorator text
  • decorator: Decorator
source

fn write_register( &mut self, instruction: &Instruction, operand: u32, instruction_operand: Option<u32>, text: &str, register: Register )

Writes a register

Arguments
  • instruction: Instruction
  • operand: Operand number, 0-based. This is a formatter operand and isn’t necessarily the same as an instruction operand.
  • instruction_operand: Instruction operand number, 0-based, or None if it’s an operand created by the formatter.
  • text: Register text
  • register: Register
source

fn write_symbol( &mut self, instruction: &Instruction, operand: u32, instruction_operand: Option<u32>, address: u64, symbol: &SymbolResult<'_> )

Writes a symbol

Arguments
  • instruction: Instruction
  • operand: Operand number, 0-based. This is a formatter operand and isn’t necessarily the same as an instruction operand.
  • instruction_operand: Instruction operand number, 0-based, or None if it’s an operand created by the formatter.
  • address: Address
  • symbol: Symbol

Implementations on Foreign Types§

source§

impl FormatterOutput for String

source§

fn write(&mut self, text: &str, _kind: FormatterTextKind)

Implementors§