angr.rust.optimization_passes.macro.fmt_template

Decoder for the core::fmt::Arguments template byte encoding introduced in rustc 1.93.

See the comment on struct Arguments in library/core/src/fmt/mod.rs.

class angr.rust.optimization_passes.macro.fmt_template.Placeholder

Bases: object

One {...} in a format template.

arg_index: int
flags: int = 1610612768
width: int | None = None
precision: int | None = None
width_indirect: bool = False
precision_indirect: bool = False
spec(trait)

Render the part after : (without the :). trait is “”, “?”, “x”, “X”, “o”, “b”, “e”, “E”, “p”.

Return type:

str

Parameters:

trait (str)

__init__(arg_index, flags=1610612768, width=None, precision=None, width_indirect=False, precision_indirect=False)
Parameters:
  • arg_index (int)

  • flags (int)

  • width (int | None)

  • precision (int | None)

  • width_indirect (bool)

  • precision_indirect (bool)

Return type:

None

angr.rust.optimization_passes.macro.fmt_template.decode_template(read, addr)

Decode a template at addr. read(addr, size) returns the bytes or None when unreadable. Returns the list of literal pieces and placeholders, or None if the bytes are not a valid template.

Return type:

list[str | Placeholder] | None

Parameters:
angr.rust.optimization_passes.macro.fmt_template.num_args(pieces)

The number of rt::Argument entries a template refers to.

Return type:

int

Parameters:

pieces (list[str | Placeholder])