diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2016-11-09 20:51:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-09 20:51:17 +0200 |
| commit | e10e49d815a0b4cd362e652f9855592b7918e711 (patch) | |
| tree | 38ffd64df3a8f3599cd52581e23f3205487af613 /src/test/incremental/thinlto | |
| parent | d712882228c9b2900fcb33a5e171553bd779116e (diff) | |
| parent | 955829cee9a5bc5b07895200df50085225bca9f6 (diff) | |
| download | rust-e10e49d815a0b4cd362e652f9855592b7918e711.tar.gz rust-e10e49d815a0b4cd362e652f9855592b7918e711.zip | |
Rollup merge of #37472 - joshtriplett:doc-fmt-write-io-write, r=brson
Document convention for using both fmt::Write and io::Write Using a trait's methods (like `Write::write_fmt` as used in `writeln!` and other macros) requires importing that trait directly (not just the module containing it). Both `fmt::Write` and `io::Write` provide compatible `Write::write_fmt` methods, and code can use `writeln!` and other macros on both an object implementing `fmt::Write` (such as a `String`) and an object implementing `io::Write` (such as `Stderr`). However, importing both `Write` traits produces an error due to the name conflict. The convention I've seen renames both of them on import, to `FmtWrite` and `IoWrite` respectively. Document that convention in the Rust documentation for `write!` and `writeln!`, with examples.
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions
