Skip to content

Commit c6b280e

Browse files
author
John Gallagher
committed
Add warning to BufWriter documentation
1 parent 55ad73b commit c6b280e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libstd/io/buffered.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ impl<R: Seek> Seek for BufReader<R> {
276276
/// `BufWriter` keeps an in-memory buffer of data and writes it to an underlying
277277
/// writer in large, infrequent batches.
278278
///
279-
/// The buffer will be written out when the writer is dropped.
279+
/// When the `BufWriter` is dropped, the contents of its buffer will be written
280+
/// out. However, any errors that happen in the process of flushing the buffer
281+
/// when the writer is dropped will be ignored. Code that wishes to handle such
282+
/// errors must manually call [`flush`] before the writer is dropped.
280283
///
281284
/// # Examples
282285
///
@@ -316,6 +319,7 @@ impl<R: Seek> Seek for BufReader<R> {
316319
/// [`Write`]: ../../std/io/trait.Write.html
317320
/// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write
318321
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html
322+
/// [`flush`]: #method.flush
319323
#[stable(feature = "rust1", since = "1.0.0")]
320324
pub struct BufWriter<W: Write> {
321325
inner: Option<W>,

0 commit comments

Comments
 (0)