Rollup merge of #132393 - zedddie16:issue-131865-fix, r=tgross35

Docs: added brief colon explanation

https://github.com/rust-lang/rust/issues/131865
(this is my first attempt at contributing, feedback is welcome)
This commit is contained in:
Matthias Krüger 2024-11-03 12:08:51 +01:00 committed by GitHub
commit e522d088fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,6 +109,16 @@
//! parameters (corresponding to `format_spec` in [the syntax](#syntax)). These //! parameters (corresponding to `format_spec` in [the syntax](#syntax)). These
//! parameters affect the string representation of what's being formatted. //! parameters affect the string representation of what's being formatted.
//! //!
//! The colon `:` in format syntax divides indentifier of the input data and
//! the formatting options, the colon itself does not change anything, only
//! introduces the options.
//!
//! ```
//! let a = 5;
//! let b = &a;
//! println!("{a:e} {b:p}"); // => 5e0 0x7ffe37b7273c
//! ```
//!
//! ## Width //! ## Width
//! //!
//! ``` //! ```