File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
branches/snap-stage3/src/libcollections Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 809a554fca2d0ebc2ba50077016fe282a4064752
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 351721cde6534d0a20bda8cbacc0019fca6caf3f
4
+ refs/heads/snap-stage3: 8a8b2cecbc1fab7ffa4a20efb6dc4deed876571e
5
5
refs/heads/try: ce76bff75603a754d092456285ff455eb871633d
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
Original file line number Diff line number Diff line change 105
105
//! hexadecimal as well as an
106
106
//! octal.
107
107
//!
108
- //! There are various parameters which do require a particular type, however.
109
- //! Namely if the syntax `{:.*}` is used, then the number of characters to print
110
- //! precedes the actual object being formatted, and the number of characters
111
- //! must have the type `usize`. Although a `usize` can be printed with `{}`, it is
112
- //! illegal to reference an argument as such. For example this is another
108
+ //! There are various parameters which do require a particular type, however. Namely, the `{:.*}`
109
+ //! syntax, which sets the number of numbers after the decimal in floating-point types:
110
+ //!
111
+ //! ```
112
+ //! let formatted_number = format!("{:.*}", 2, 1.234567);
113
+ //!
114
+ //! assert_eq!("1.23", formatted_number)
115
+ //! ```
116
+ //!
117
+ //! If this syntax is used, then the number of characters to print precedes the actual object being
118
+ //! formatted, and the number of characters must have the type `usize`. Although a `usize` can be
119
+ //! printed with `{}`, it is illegal to reference an argument as such. For example this is another
113
120
//! invalid format string:
114
121
//!
115
122
//! ```text
You can’t perform that action at this time.
0 commit comments