Skip to content

Commit 286ce3c

Browse files
authored
Rollup merge of rust-lang#57452 - steveklabnik:improve-formatter-docs, r=frewsxcv
Improve docs for Formatter Some improvements to `std::fmt::Formatter` to make it a bit more consistent with other documentation, as well as calling out that you don't ever instantiate one yourself.
2 parents 9323499 + 5fc6fc3 commit 286ce3c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/libcore/fmt/mod.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,18 @@ impl<W: Write + ?Sized> Write for &mut W {
211211
}
212212
}
213213

214-
/// A struct to represent both where to emit formatting strings to and how they
215-
/// should be formatted. A mutable version of this is passed to all formatting
216-
/// traits.
214+
/// Configuration for formatting.
215+
///
216+
/// A `Formatter` represents various options related to formatting. Users do not
217+
/// construct `Formatter`s directly; a mutable reference to one is passed to
218+
/// the `fmt` method of all formatting traits, like [`Debug`] and [`Display`].
219+
///
220+
/// To interact with a `Formatter`, you'll call various methods to change the
221+
/// various options related to formatting. For examples, please see the
222+
/// documentation of the methods defined on `Formatter` below.
223+
///
224+
/// [`Debug`]: trait.Debug.html
225+
/// [`Display`]: trait.Display.html
217226
#[allow(missing_debug_implementations)]
218227
#[stable(feature = "rust1", since = "1.0.0")]
219228
pub struct Formatter<'a> {

0 commit comments

Comments
 (0)