-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Provide a cleaner documentation for 'write!' #35279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,14 +229,26 @@ macro_rules! try { | |
| }) | ||
| } | ||
|
|
||
| /// Use the `format!` syntax to write data into a buffer. | ||
| /// Calls `write_fmt` function on a writer | ||
|
||
| /// | ||
| /// This macro is typically used with a buffer of `&mut `[`Write`][write]. | ||
| /// This macro takes an implementor of [`std::fmt::Write`][fmt_write] or | ||
| /// [`std::io::Write`][io_write] trait, a format string, and a list of arguments. | ||
|
||
| /// | ||
| /// Implementors of the `Write` trait are sometimes called 'writers'. | ||
|
||
| /// | ||
| /// These arguments will be formatted according to the specified format string and | ||
| /// the resulting string will be passed to the writer. | ||
| /// | ||
| /// Return value is either [`Result`][enum_result] or [`io::Result`][type_result] depending on | ||
|
||
| /// the writer. | ||
| /// | ||
| /// See [`std::fmt`][fmt] for more information on format syntax. | ||
| /// | ||
| /// [fmt]: ../std/fmt/index.html | ||
| /// [write]: ../std/io/trait.Write.html | ||
| /// [fmt_write]: ../std/fmt/trait.Write.html | ||
| /// [io_write]: ../std/io/trait.Write.html | ||
| /// [enum_result]: ../std/result/enum.Result.html | ||
| /// [type_result]: ../std/io/type.Result.html | ||
| /// | ||
| /// # Examples | ||
| /// | ||
|
|
@@ -255,16 +267,29 @@ macro_rules! write { | |
| ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*))) | ||
| } | ||
|
|
||
| /// Use the `format!` syntax to write data into a buffer, appending a newline. | ||
| /// Calls `write_fmt` function on a writer, with appending a newline. | ||
| /// | ||
| /// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`) | ||
| /// alone (no additional CARRIAGE RETURN (`\r`/`U+000D`). | ||
| /// | ||
| /// This macro is typically used with a buffer of `&mut `[`Write`][write]. | ||
| /// This macro takes an implementor of [`std::fmt::Write`][fmt_write] or | ||
| /// [`std::io::Write`][io_write] trait, a format string, and a list of arguments. | ||
| /// | ||
| /// Implementors of the `Write` trait are sometimes called 'writers'. | ||
| /// | ||
| /// These arguments will be formatted according to the specified format string and | ||
| /// the resulting string will be passed to the writer. | ||
| /// | ||
| /// Return value is either [`Result`][enum_result] or [`io::Result`][type_result] depending on | ||
| /// the writer. | ||
| /// | ||
| /// See [`std::fmt`][fmt] for more information on format syntax. | ||
| /// | ||
| /// [fmt]: ../std/fmt/index.html | ||
| /// [write]: ../std/io/trait.Write.html | ||
| /// [fmt_write]: ../std/fmt/trait.Write.html | ||
| /// [io_write]: ../std/io/trait.Write.html | ||
| /// [enum_result]: ../std/result/enum.Result.html | ||
| /// [type_result]: ../std/io/type.Result.html | ||
| /// | ||
| /// # Examples | ||
| /// | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steveklabnik Hello. Can you suggest a better, "friendlier" description instead of this? 😄