]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/io/buffered.rs
Document that `std::io::BufReader` discards contents on drop
[rust.git] / src / libstd / io / buffered.rs
index 4668e3ec7eabda0a882347f1ef09d050bf713c30..487706b05bb45628c015346e0bd73369deeed403 100644 (file)
 /// times. It also provides no advantage when reading from a source that is
 /// already in memory, like a `Vec<u8>`.
 ///
+/// When the `BufReader` is dropped, the contents of its buffer will be
+/// discarded. Creating multiple instances of a `BufReader` on the same
+/// stream can cause data loss.
+///
 /// [`Read`]: ../../std/io/trait.Read.html
 /// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read
 /// [`TcpStream`]: ../../std/net/struct.TcpStream.html