Closed
Description
All the Writer
adaptors that libstd provides that have some sort of internal buffer should expose a method named .flush_outer()
that flushes this internal buffer. Basically, whatever it does in .flush()
besides flushing the inner writer. For example, in BufferedWriter
it would be the flush_buf()
method.
This would be useful when the client needs to handle errors from this shallow flush but doesn't want to flush the full writer stack. For example, before calling BufferedWriter.unwrap()
, the client could use .flush_buf()
to get the error, as BufferedWriter.unwrap()
will fail otherwise.
Similarly, LineBufferedWriter
could call self.inner.flush_outer()
in write()
instead of calling self.inner.flush()
.
Metadata
Metadata
Assignees
Labels
No labels