What does {:?} mean in a Rust format string?

This is explained (along with the rest of the formatting syntax) in the std::fmt documentation.

{...} surrounds all formatting directives. : separates the name or ordinal of the thing being formatted (which in this case is omitted, and thus means “the next thing”) from the formatting options. The ? is a formatting option that triggers the use of the std::fmt::Debug implementation of the thing being formatted, as opposed to the default Display trait, or one of the other traits (like UpperHex or Octal).

Thus, {:?} formats the “next” value passed to a formatting macro, and supports anything that implements Debug.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)