|
128 | 128 | //! This allows multiple actual types to be formatted via `{:x}` (like `i8` as
|
129 | 129 | //! well as `isize`). The current mapping of types to traits is:
|
130 | 130 | //!
|
131 |
| -//! * *nothing* ⇒ `Display` |
132 |
| -//! * `?` ⇒ `Debug` |
133 |
| -//! * `o` ⇒ `Octal` |
134 |
| -//! * `x` ⇒ `LowerHex` |
135 |
| -//! * `X` ⇒ `UpperHex` |
136 |
| -//! * `p` ⇒ `Pointer` |
137 |
| -//! * `b` ⇒ `Binary` |
138 |
| -//! * `e` ⇒ `LowerExp` |
139 |
| -//! * `E` ⇒ `UpperExp` |
| 131 | +//! * *nothing* ⇒ [`Display`](trait.Display.html) |
| 132 | +//! * `?` ⇒ [`Debug`](trait.Debug.html) |
| 133 | +//! * `o` ⇒ [`Octal`](trait.Octal.html) |
| 134 | +//! * `x` ⇒ [`LowerHex`](trait.LowerHex.html) |
| 135 | +//! * `X` ⇒ [`UpperHex`](trait.UpperHex.html) |
| 136 | +//! * `p` ⇒ [`Pointer`](trait.Pointer.html) |
| 137 | +//! * `b` ⇒ [`Binary`](trait.Binary.html) |
| 138 | +//! * `e` ⇒ [`LowerExp`](trait.LowerExp.html) |
| 139 | +//! * `E` ⇒ [`UpperExp`](trait.UpperExp.html) |
140 | 140 | //!
|
141 | 141 | //! What this means is that any type of argument which implements the
|
142 | 142 | //! `fmt::Binary` trait can then be formatted with `{:b}`. Implementations
|
|
367 | 367 | //! should always be printed.
|
368 | 368 | //! * '-' - Currently not used
|
369 | 369 | //! * '#' - This flag is indicates that the "alternate" form of printing should
|
370 |
| -//! be used. For array slices, the alternate form omits the brackets. |
371 |
| -//! For the integer formatting traits, the alternate forms are: |
| 370 | +//! be used. The alternate forms are: |
| 371 | +//! * `#?` - pretty-print the `Debug` formatting |
372 | 372 | //! * `#x` - precedes the argument with a "0x"
|
373 | 373 | //! * `#X` - precedes the argument with a "0x"
|
374 |
| -//! * `#t` - precedes the argument with a "0b" |
| 374 | +//! * `#b` - precedes the argument with a "0b" |
375 | 375 | //! * `#o` - precedes the argument with a "0o"
|
376 | 376 | //! * '0' - This is used to indicate for integer formats that the padding should
|
377 | 377 | //! both be done with a `0` character as well as be sign-aware. A format
|
|
408 | 408 | //!
|
409 | 409 | //! There are three possible ways to specify the desired `precision`:
|
410 | 410 | //!
|
411 |
| -//! There are three possible ways to specify the desired `precision`: |
412 |
| -//! 1. An integer `.N`, |
413 |
| -//! 2. an integer followed by dollar sign `.N$`, or |
414 |
| -//! 3. an asterisk `.*`. |
| 411 | +//! 1. An integer `.N`: |
| 412 | +//! |
| 413 | +//! the integer `N` itself is the precision. |
| 414 | +//! |
| 415 | +//! 2. An integer followed by dollar sign `.N$`: |
415 | 416 | //!
|
416 |
| -//! The first specification, `.N`, means the integer `N` itself is the precision. |
| 417 | +//! use format *argument* `N` (which must be a `usize`) as the precision. |
417 | 418 | //!
|
418 |
| -//! The second, `.N$`, means use format *argument* `N` (which must be a `usize`) as the precision. |
| 419 | +//! 3. An asterisk `.*`: |
419 | 420 | //!
|
420 |
| -//! Finally, `.*` means that this `{...}` is associated with *two* format inputs rather than one: |
421 |
| -//! the first input holds the `usize` precision, and the second holds the value to print. Note |
422 |
| -//! that in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part |
423 |
| -//! refers to the *value* to print, and the `precision` must come in the input preceding `<arg>`. |
| 421 | +//! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the |
| 422 | +//! first input holds the `usize` precision, and the second holds the value to print. Note that |
| 423 | +//! in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part refers |
| 424 | +//! to the *value* to print, and the `precision` must come in the input preceding `<arg>`. |
424 | 425 | //!
|
425 | 426 | //! For example, these:
|
426 | 427 | //!
|
|
0 commit comments