Fix is_write_vectored in LineWriterShim

Now that BufWriter always claims to support vectored writes,
look through it at the wrapped writer to decide whether to
use vectored writes for LineWriter.
This commit is contained in:
Mikhail Zabaluev 2020-11-08 01:46:05 +02:00
parent 9fc44239ec
commit 00deeb35c8

View File

@ -20,6 +20,12 @@ impl<'a, W: Write> LineWriterShim<'a, W> {
Self { buffer }
}
/// Get a reference to the inner writer (that is, the writer
/// wrapped by the BufWriter).
fn inner(&self) -> &W {
self.buffer.get_ref()
}
/// Get a mutable reference to the inner writer (that is, the writer
/// wrapped by the BufWriter). Be careful with this writer, as writes to
/// it will bypass the buffer.
@ -227,7 +233,7 @@ impl<'a, W: Write> Write for LineWriterShim<'a, W> {
}
fn is_write_vectored(&self) -> bool {
self.buffer.is_write_vectored()
self.inner().is_write_vectored()
}
/// Write some data into this BufReader with line buffering. This means