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

    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

Writes text and text kind

Arguments
  • text: Text
  • kind: Text kind

Provided Methods

Writes a prefix

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

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

  • instruction: Instruction
  • text: Mnemonic text

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

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

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

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

Implementors