Skip to content

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

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

Open
steveklabnik opened this issue Jan 23, 2015 · 0 comments
Open

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

steveklabnik opened this issue Jan 23, 2015 · 0 comments
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.

Comments

@steveklabnik
Copy link
Member

Issue by kballard
Wednesday Apr 30, 2014 at 03:50 GMT

For earlier discussion, see rust-lang/rust#13858

This issue was labelled with: in the Rust repository


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

@petrochenkov petrochenkov added the T-libs-api Relevant to the library API team, which will review and decide on the RFC. label Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

2 participants