Skip to main content

StringFormatter

Struct StringFormatter 

Source
pub struct StringFormatter { /* private fields */ }
Expand description

Structured formatter that accumulates text into an owned string.

Implementations§

Source§

impl StringFormatter

Source

pub const fn new(options: FormatOptions) -> Self

Construct an empty formatter.

Source

pub fn clear(&mut self)

Remove all text while retaining the allocated buffer for reuse.

Source

pub fn as_str(&self) -> &str

Return the text written so far.

Source

pub fn into_string(self) -> String

Consume the formatter and return its text.

Trait Implementations§

Source§

impl FormatIns for StringFormatter

Source§

fn options(&self) -> &FormatOptions

Return rendering-only options.
Source§

fn write_space(&mut self) -> Result

Write the gap between mnemonic and operands.
Source§

fn write_separator(&mut self) -> Result

Write an operand separator.
Source§

fn write_reg(&mut self, reg: Reg) -> Result

Write a general-purpose register.
Source§

fn write_bank_reg(&mut self, reg: BankReg) -> Result

Write a banked register.
Source§

fn write_freg(&mut self, reg: FReg) -> Result

Write a single-precision register view.
Source§

fn write_dreg(&mut self, reg: DReg) -> Result

Write a double-precision register view.
Source§

fn write_vecreg(&mut self, reg: VecReg) -> Result

Write a vector register view.
Source§

fn write_uimm(&mut self, value: u32) -> Result

Write an unsigned immediate.
Source§

fn write_simm(&mut self, value: i32) -> Result

Write a signed immediate.
Source§

fn write_displacement(&mut self, _encoded: Disp, value: u32) -> Result

Write an encoded displacement and its scaled value.
Source§

fn write_pc_relative(&mut self, _encoded: Disp, target: Address) -> Result

Write a resolved PC-relative operand.
Source§

fn write_branch(&mut self, target: Address) -> Result

Write a resolved direct branch destination.
Source§

fn write_ins(&mut self, ins: &Ins, address: u32) -> Result

Write a complete instruction at an address.
Source§

impl Write for StringFormatter

Source§

fn write_str(&mut self, value: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.