i keep seeing this pattern
{:?}
what does it mean? or what is the correct terminology?
i keep seeing this pattern
{:?}
what does it mean? or what is the correct terminology?
It's a formatting parameter that means "use the fmt::Debug
implementation to format this one". So if something has a Debug
implementation (which can usually be easily derived), but not a Display
implementation, you'll need to use {:?}
. (Even if it has a Display
implementation, sometimes the Debug
implementation will give you more information... which may be useful for debugging, say.)
I would say it's a "formatting (sub)string" or placeholder inside a formatting string, with a "next argument" specifier {}
and a formatting paramater ?
(after a colon inside the curly braces) to select Debug
formatting.
See: std::fmt - Rust
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.