Crate rustc_parse_format

source
Expand description

Macro support for format strings

These structures are used when parsing format strings for the compiler. Parsing does not happen at runtime: structures of std::fmt::rt are generated instead.

Re-exportsยง

Structsยง

  • Representation of an argument specification.
  • Specification for the formatting of an argument in the format string.
  • InnerOffset ๐Ÿ”’
  • Range inside of a Span used for diagnostics when we only have access to relative positions.
  • The location and before/after width of a character whose width has changed from its source code representation
  • The parser structure for interpreting the input format string. This is modeled as an iterator over Piece structures to form a stream of tokens being output.

Enumsยง

  • Enum of alignments which are supported.
  • A count is used for the precision and width parameters of an integer, and can reference either an argument or a literal integer.
  • Enum for the debug hex flags.
  • InputStringKind ๐Ÿ”’
    Whether the input string is a literal. If yes, it contains the inner width mappings.
  • The type of format string that we are parsing.
  • A piece is a portion of the format string which represents the next part to emit. These are emitted as a stream by the Parser class.
  • Enum describing where an argument for a format can be located.
  • Enum for the sign flags.

Functionsยง

  • Finds the indices of all characters that have been processed and differ between the actual written code (code snippet) and the InternedString that gets processed in the Parser in order to properly synthesise the intra-string Spans for error diagnostics.
  • unescape_string ๐Ÿ”’