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

std::io::{empty, sink} do not replace /dev/null #24235

Closed
aturon opened this issue Apr 9, 2015 · 4 comments
Closed

std::io::{empty, sink} do not replace /dev/null #24235

aturon opened this issue Apr 9, 2015 · 4 comments

Comments

@aturon
Copy link
Member

aturon commented Apr 9, 2015

In particular, splitting up the Read and Write halves mean that you can't use these in a generic context that expects a full stream (Read + Write).

We should consider deprecating these in favor of a single null constructor that is both Read and Write.

@aturon aturon added the A-io label Apr 9, 2015
@aturon
Copy link
Member Author

aturon commented Apr 9, 2015

cc @alexcrichton

@alexcrichton
Copy link
Member

I'm personally comfortable with a io::null name, but if we were to deprecate the empty/sink constructors in favor of this we'd want to basically insta-stabilize it at which point we may want to get some more consensus before taking action.

@steveklabnik
Copy link
Member

empty and sink are now stable, so I guess this can be closed?

@alexcrichton
Copy link
Member

Yeah I think this better belongs as an RFC issue nowadays and I haven't heard much of a desire for this recently so we may be covered.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jul 30, 2023
merge functionality of `io::Sink` into `io::Empty`

Many times, there is a need for a simple dummy `io::Read`er + `io::Write`r, but currently the only options are `io::Empty` and `io::Sink` respectively. Having both of their functionality together requires writing your own boilerplate for something that makes sense to have in the standard library. This PR adds the functionality of `io::Sink` to `io::Empty`, making `io::Empty` be able to perform the tasks of both of the previous structs. (This idea was first mentioned in rust-lang#24235)

Note: I also updated some doc comments in `io::utils` in this pull request to fix inconsistencies between `io::Sink` and `io::Empty`.

API Change Proposal: rust-lang/libs-team#49
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 30, 2023
merge functionality of `io::Sink` into `io::Empty`

Many times, there is a need for a simple dummy `io::Read`er + `io::Write`r, but currently the only options are `io::Empty` and `io::Sink` respectively. Having both of their functionality together requires writing your own boilerplate for something that makes sense to have in the standard library. This PR adds the functionality of `io::Sink` to `io::Empty`, making `io::Empty` be able to perform the tasks of both of the previous structs. (This idea was first mentioned in rust-lang#24235)

Note: I also updated some doc comments in `io::utils` in this pull request to fix inconsistencies between `io::Sink` and `io::Empty`.

API Change Proposal: rust-lang/libs-team#49
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

3 participants