File tree Expand file tree Collapse file tree 1 file changed +4
-21
lines changed Expand file tree Collapse file tree 1 file changed +4
-21
lines changed Original file line number Diff line number Diff line change 6262//!
6363//! A format string is required to use all of its arguments, otherwise it is a
6464//! compile-time error. You may refer to the same argument more than once in the
65- //! format string, although it must always be referred to with the same type .
65+ //! format string.
6666//!
6767//! ## Named parameters
6868//!
8989//!
9090//! ## Argument types
9191//!
92- //! Each argument's type is dictated by the format string. It is a requirement
93- //! that every argument is only ever referred to by one type. For example, this
94- //! is an invalid format string:
95- //!
96- //! ```text
97- //! {0:x} {0:o}
98- //! ```
99- //!
100- //! This is invalid because the first argument is both referred to as a
101- //! hexadecimal as well as an
102- //! octal.
103- //!
104- //! There are various parameters which do require a particular type, however.
92+ //! Each argument's type is dictated by the format string.
93+ //! There are various parameters which require a particular type, however.
10594//! An example is the `{:.*}` syntax, which sets the number of decimal places
10695//! in floating-point types:
10796//!
113102//!
114103//! If this syntax is used, then the number of characters to print precedes the
115104//! actual object being formatted, and the number of characters must have the
116- //! type `usize`. Although a `usize` can be printed with `{}`, it is invalid to
117- //! reference an argument as such. For example this is another invalid format
118- //! string:
119- //!
120- //! ```text
121- //! {:.*} {0}
122- //! ```
105+ //! type `usize`.
123106//!
124107//! ## Formatting traits
125108//!
You can’t perform that action at this time.
0 commit comments