Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writer adaptors should have a public method flush_outer() #13858

Closed
lilyball opened this issue Apr 30, 2014 · 1 comment
Closed

Writer adaptors should have a public method flush_outer() #13858

lilyball opened this issue Apr 30, 2014 · 1 comment

Comments

@lilyball
Copy link
Contributor

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().

@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants