std::fmt: Added argument index comments to examples for specifying precision
The examples for specifying the precision have comments explaining which argument the specifier is referring to. However, for implicit positional arguments, the examples simply talk about "next arg". To make it easier for readers to follow the comments, "next arg" was supplemented with the actual resulting argument index.
This commit is contained in:
parent
1288883932
commit
afd80a21b0
@ -240,19 +240,19 @@
|
||||
//! // Hello {arg 0 ("x")} is {arg 2 (0.01) with precision specified in arg 1 (5)}
|
||||
//! println!("Hello {0} is {2:.1$}", "x", 5, 0.01);
|
||||
//!
|
||||
//! // Hello {next arg ("x")} is {second of next two args (0.01) with precision
|
||||
//! // specified in first of next two args (5)}
|
||||
//! // Hello {next arg -> arg 0 ("x")} is {second of next two args -> arg 2 (0.01) with precision
|
||||
//! // specified in first of next two args -> arg 1 (5)}
|
||||
//! println!("Hello {} is {:.*}", "x", 5, 0.01);
|
||||
//!
|
||||
//! // Hello {arg 1 ("x")} is {arg 2 (0.01) with precision
|
||||
//! // specified in next arg (5)}
|
||||
//! // specified in next arg -> arg 0 (5)}
|
||||
//! println!("Hello {1} is {2:.*}", 5, "x", 0.01);
|
||||
//!
|
||||
//! // Hello {next arg ("x")} is {arg 2 (0.01) with precision
|
||||
//! // specified in next arg (5)}
|
||||
//! // Hello {next arg -> arg 0 ("x")} is {arg 2 (0.01) with precision
|
||||
//! // specified in next arg -> arg 1 (5)}
|
||||
//! println!("Hello {} is {2:.*}", "x", 5, 0.01);
|
||||
//!
|
||||
//! // Hello {next arg ("x")} is {arg "number" (0.01) with precision specified
|
||||
//! // Hello {next arg -> arg 0 ("x")} is {arg "number" (0.01) with precision specified
|
||||
//! // in arg "prec" (5)}
|
||||
//! println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
|
||||
//! ```
|
||||
|
Loading…
Reference in New Issue
Block a user