rust-lang / rust-lang/rfcs

Writer adaptors should have a public method flush_outer()

Open
#719 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-libs
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

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

For earlier discussion, see https://github.com/rust-lang/rust/issues/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().

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the earlier discussion in Rust issue #13858 and inspect the standard library's Writer adaptors, especially BufferedWriter and LineBufferedWriter. Determine which adaptors need a public flush_outer() operation and how it should interact with existing flush behavior; the work is done when the API and adaptor behavior are consistently specified and implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.