@@ -9,21 +9,21 @@ use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom,
99 IoSliceMut } ;
1010use crate :: memchr;
1111
12- /// The `BufReader` struct adds buffering to any reader.
12+ /// The `BufReader<R> ` struct adds buffering to any reader.
1313///
1414/// It can be excessively inefficient to work directly with a [`Read`] instance.
1515/// For example, every call to [`read`][`TcpStream::read`] on [`TcpStream`]
16- /// results in a system call. A `BufReader` performs large, infrequent reads on
16+ /// results in a system call. A `BufReader<R> ` performs large, infrequent reads on
1717/// the underlying [`Read`] and maintains an in-memory buffer of the results.
1818///
19- /// `BufReader` can improve the speed of programs that make *small* and
19+ /// `BufReader<R> ` can improve the speed of programs that make *small* and
2020/// *repeated* read calls to the same file or network socket. It does not
2121/// help when reading very large amounts at once, or reading just one or a few
2222/// times. It also provides no advantage when reading from a source that is
2323/// already in memory, like a `Vec<u8>`.
2424///
25- /// When the `BufReader` is dropped, the contents of its buffer will be
26- /// discarded. Creating multiple instances of a `BufReader` on the same
25+ /// When the `BufReader<R> ` is dropped, the contents of its buffer will be
26+ /// discarded. Creating multiple instances of a `BufReader<R> ` on the same
2727/// stream can cause data loss.
2828///
2929/// [`Read`]: ../../std/io/trait.Read.html
@@ -56,7 +56,7 @@ pub struct BufReader<R> {
5656}
5757
5858impl < R : Read > BufReader < R > {
59- /// Creates a new `BufReader` with a default buffer capacity. The default is currently 8 KB,
59+ /// Creates a new `BufReader<R> ` with a default buffer capacity. The default is currently 8 KB,
6060 /// but may change in the future.
6161 ///
6262 /// # Examples
@@ -76,7 +76,7 @@ impl<R: Read> BufReader<R> {
7676 BufReader :: with_capacity ( DEFAULT_BUF_SIZE , inner)
7777 }
7878
79- /// Creates a new `BufReader` with the specified buffer capacity.
79+ /// Creates a new `BufReader<R> ` with the specified buffer capacity.
8080 ///
8181 /// # Examples
8282 ///
@@ -177,7 +177,7 @@ impl<R> BufReader<R> {
177177 & self . buf [ self . pos ..self . cap ]
178178 }
179179
180- /// Unwraps this `BufReader`, returning the underlying reader.
180+ /// Unwraps this `BufReader<R> `, returning the underlying reader.
181181 ///
182182 /// Note that any leftover data in the internal buffer is lost.
183183 ///
@@ -304,7 +304,7 @@ impl<R: Seek> Seek for BufReader<R> {
304304 /// Seek to an offset, in bytes, in the underlying reader.
305305 ///
306306 /// The position used for seeking with `SeekFrom::Current(_)` is the
307- /// position the underlying reader would be at if the `BufReader` had no
307+ /// position the underlying reader would be at if the `BufReader<R> ` had no
308308 /// internal buffer.
309309 ///
310310 /// Seeking always discards the internal buffer, even if the seek position
@@ -355,16 +355,16 @@ impl<R: Seek> Seek for BufReader<R> {
355355/// It can be excessively inefficient to work directly with something that
356356/// implements [`Write`]. For example, every call to
357357/// [`write`][`TcpStream::write`] on [`TcpStream`] results in a system call. A
358- /// `BufWriter` keeps an in-memory buffer of data and writes it to an underlying
358+ /// `BufWriter<W> ` keeps an in-memory buffer of data and writes it to an underlying
359359/// writer in large, infrequent batches.
360360///
361- /// `BufWriter` can improve the speed of programs that make *small* and
361+ /// `BufWriter<W> ` can improve the speed of programs that make *small* and
362362/// *repeated* write calls to the same file or network socket. It does not
363363/// help when writing very large amounts at once, or writing just one or a few
364364/// times. It also provides no advantage when writing to a destination that is
365365/// in memory, like a `Vec<u8>`.
366366///
367- /// It is critical to call [`flush`] before `BufWriter` is dropped. Though
367+ /// It is critical to call [`flush`] before `BufWriter<W> ` is dropped. Though
368368/// dropping will attempt to flush the the contents of the buffer, any errors
369369/// that happen in the process will be ignored. Calling ['flush'] ensures that
370370/// the buffer is empty and all errors have been observed.
@@ -386,7 +386,7 @@ impl<R: Seek> Seek for BufReader<R> {
386386///
387387/// Because we're not buffering, we write each one in turn, incurring the
388388/// overhead of a system call per byte written. We can fix this with a
389- /// `BufWriter`:
389+ /// `BufWriter<W> `:
390390///
391391/// ```no_run
392392/// use std::io::prelude::*;
@@ -401,7 +401,7 @@ impl<R: Seek> Seek for BufReader<R> {
401401/// stream.flush().unwrap();
402402/// ```
403403///
404- /// By wrapping the stream with a `BufWriter`, these ten writes are all grouped
404+ /// By wrapping the stream with a `BufWriter<W> `, these ten writes are all grouped
405405/// together by the buffer and will all be written out in one system call when
406406/// the `stream` is flushed.
407407///
@@ -448,7 +448,7 @@ pub struct BufWriter<W: Write> {
448448pub struct IntoInnerError < W > ( W , Error ) ;
449449
450450impl < W : Write > BufWriter < W > {
451- /// Creates a new `BufWriter` with a default buffer capacity. The default is currently 8 KB,
451+ /// Creates a new `BufWriter<W> ` with a default buffer capacity. The default is currently 8 KB,
452452 /// but may change in the future.
453453 ///
454454 /// # Examples
@@ -464,7 +464,7 @@ impl<W: Write> BufWriter<W> {
464464 BufWriter :: with_capacity ( DEFAULT_BUF_SIZE , inner)
465465 }
466466
467- /// Creates a new `BufWriter` with the specified buffer capacity.
467+ /// Creates a new `BufWriter<W> ` with the specified buffer capacity.
468468 ///
469469 /// # Examples
470470 ///
@@ -565,7 +565,7 @@ impl<W: Write> BufWriter<W> {
565565 & self . buf
566566 }
567567
568- /// Unwraps this `BufWriter`, returning the underlying writer.
568+ /// Unwraps this `BufWriter<W> `, returning the underlying writer.
569569 ///
570570 /// The buffer is written out before returning the writer.
571571 ///
0 commit comments