From 81b20e0a3dd3d8c567c1e81e0a3e7bcbdea94715 Mon Sep 17 00:00:00 2001 From: tuturuu Date: Thu, 31 Oct 2024 08:23:50 +0100 Subject: [PATCH] Rustdoc: added brief colon explanation --- alloc/src/fmt.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/alloc/src/fmt.rs b/alloc/src/fmt.rs index 3da71038a5e76..695dddb25eeb4 100644 --- a/alloc/src/fmt.rs +++ b/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 //! //! ```