about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-03 12:08:51 +0100
committerGitHub <noreply@github.com>2024-11-03 12:08:51 +0100
commite522d088fd07b87b254ce722328d0cd5cc0cd2f4 (patch)
tree6137e330ebca8949e7c304a9fd490a1eb46b512f /library/alloc/src
parentb9f972767cd827aed1613897c4367f567daaf7a3 (diff)
parentc7b07d58c32d015e8f26da0bd3defd6898aac2b7 (diff)
downloadrust-e522d088fd07b87b254ce722328d0cd5cc0cd2f4.tar.gz
rust-e522d088fd07b87b254ce722328d0cd5cc0cd2f4.zip
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)
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/fmt.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs
index 3da71038a5e..695dddb25ee 100644
--- a/library/alloc/src/fmt.rs
+++ b/library/alloc/src/fmt.rs
@@ -109,6 +109,16 @@
 //! parameters (corresponding to `format_spec` in [the syntax](#syntax)). These
 //! 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
 //!
 //! ```