Uh oh!
There was an error while loading. Please reload this page.
std: Implement stdio for std::io - #22797
Conversation
rust-highfive
commented
Feb 25, 2015
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Feb 25, 2015
Note that this PR is not intended to be the final result of these functions. This will likely land ahead of the RFC but only because it facilitates migration to r? @aturon API-wise |
alexcrichton
commented
Feb 25, 2015
Ah I will try to add some tests soon as well. I'll both add some independent ones as well as migrate some existing run-pass/bench tests to this API. |
There was a problem hiding this comment.
I believe you should just go ahead and do self.inner.flush() here, even if the inner returns Ok(()) anyway.
There was a problem hiding this comment.
The inner doesn't actually implement flush in this case. Each of the underlying primitives implement write as an inherent method (taking &self) so there's no flush method to call.
There was a problem hiding this comment.
It does implement it at https://github.com/rust-lang/rust/pull/22797/files#diff-c7c55a739480d5cc82ecd059127d62a9R78. I just generally prefer seeing wrapper structures like StderrLock not assume anything about the object it wraps and just pass the responsibility of doing what’s right to the object it wraps over.
Anyway that’s just a nit and general style preference, so you’re free to ignore it.
There was a problem hiding this comment.
Gah sorry, was thinking of the wrong thing, I will definitely delegate!
nagisa
commented
Feb 25, 2015
I’ve finished my pass over it 😉 |
aturon
commented
Feb 25, 2015
API looks fine to me. I may want to make a few tweaks but we can work this out on the RFC. Thanks @alexcrichton! |
e5580c7 to
8fa751dComparealexcrichton
commented
Feb 25, 2015
I've pushed an update that removes all I have also now updated with some usage in tests as well (and will add some more over time as well). |
aturon
commented
Feb 27, 2015
@bors: r+ 5c0ed68 |
alexcrichton
commented
Feb 27, 2015
@bors: r=aturon 1c32ac7 |
bors
commented
Feb 27, 2015
⌛ Testing commit 1c32ac7 with merge a8b753b... |
bors
commented
Feb 27, 2015
💔 Test failed - auto-mac-32-opt |
alexcrichton
commented
Feb 27, 2015
@bors: retry |
bors
commented
Feb 28, 2015
⌛ Testing commit 1c32ac7 with merge be1f11a... |
bors
commented
Feb 28, 2015
💔 Test failed - auto-win-32-nopt-t |
03e97a8 to
c1854a8CompareThis is an implementation of RFC 899 and adds stdio functionality to the new
`std::io` module. Details of the API can be found on the RFC, but from a high
level:
* `io::{stdin, stdout, stderr}` constructors are now available. There are also
`*_raw` variants for unbuffered and unlocked access.
* All handles are globally shared (excluding raw variants).
* The stderr handle is no longer buffered.
* All handles can be explicitly locked (excluding the raw variants).
The `print!` and `println!` machinery has not yet been hooked up to these
streams just yet. The `std::fmt::output` module has also not yet been
implemented as part of this commit.alexcrichton
commented
Mar 1, 2015
This is an implementation of RFC 899 and adds stdio functionality to the new
`std::io` module. Details of the API can be found on the RFC, but from a high
level:
* `io::{stdin, stdout, stderr}` constructors are now available. There are also
`*_raw` variants for unbuffered and unlocked access.
* All handles are globally shared (excluding raw variants).
* The stderr handle is no longer buffered.
* All handles can be explicitly locked (excluding the raw variants).
The `print!` and `println!` machinery has not yet been hooked up to these
streams just yet. The `std::fmt::output` module has also not yet been
implemented as part of this commit.bors
commented
Mar 1, 2015
bors
commented
Mar 1, 2015
💔 Test failed - auto-linux-64-x-android-t |
pnkfelix
commented
Mar 1, 2015
@bors retry |
bors
commented
Mar 1, 2015
⚡ Previous build results are reusable. Rebuilding only auto-linux-32-nopt-t, auto-linux-32-opt, auto-linux-64-nopt-t, auto-linux-64-opt, auto-linux-64-x-android-t, auto-mac-32-opt, auto-mac-64-nopt-t, auto-mac-64-opt, auto-win-32-nopt-t, auto-win-32-opt, auto-win-64-nopt-t, auto-win-64-opt... |
bors
commented
Mar 1, 2015
💔 Test failed - auto-win-32-opt |
Manishearth
commented
Mar 1, 2015
@bors retry |
bors
commented
Mar 1, 2015
⌛ Testing commit 94d71f8 with merge 13769d8... |
bors
commented
Mar 1, 2015
💔 Test failed - auto-linux-64-x-android-t |
sfackler
commented
Mar 1, 2015
@bors retry |
bors
commented
Mar 1, 2015
⚡ Previous build results are reusable. Rebuilding only auto-linux-32-nopt-t, auto-linux-32-opt, auto-linux-64-nopt-t, auto-linux-64-opt, auto-linux-64-x-android-t, auto-mac-32-opt, auto-mac-64-nopt-t, auto-mac-64-opt, auto-win-32-nopt-t, auto-win-32-opt, auto-win-64-nopt-t, auto-win-64-opt... |
bors
commented
Mar 1, 2015
💔 Test failed - auto-linux-64-x-android-t |
Manishearth
commented
Mar 1, 2015
@bors: retry |
bors
commented
Mar 1, 2015
⚡ Previous build results are reusable. Rebuilding only auto-linux-32-nopt-t, auto-linux-32-opt, auto-linux-64-nopt-t, auto-linux-64-x-android-t, auto-mac-32-opt, auto-mac-64-nopt-t, auto-win-32-nopt-t, auto-win-32-opt, auto-win-64-nopt-t, auto-win-64-opt... |
bors
commented
Mar 1, 2015
💔 Test failed - auto-win-64-nopt-t |
Manishearth
commented
Mar 1, 2015
Er, what? Second time I've seen that failure today. Looks deterministic. |
sfackler
commented
Mar 2, 2015
@bors retry |
This is an implementation of RFC 899 and adds stdio functionality to the new
`std::io` module. Details of the API can be found on the RFC, but from a high
level:
* `io::{stdin, stdout, stderr}` constructors are now available. There are also
`*_raw` variants for unbuffered and unlocked access.
* All handles are globally shared (excluding raw variants).
* The stderr handle is no longer buffered.
* All handles can be explicitly locked (excluding the raw variants).
The `print!` and `println!` machinery has not yet been hooked up to these
streams just yet. The `std::fmt::output` module has also not yet been
implemented as part of this commit.bors
commented
Mar 2, 2015
⌛ Testing commit 94d71f8 with merge c514205... |
This is an implementation of RFC 899 and adds stdio functionality to the new
std::iomodule. Details of the API can be found on the RFC, but from a highlevel:
io::{stdin, stdout, stderr}constructors are now available. There are also*_rawvariants for unbuffered and unlocked access.The
print!andprintln!machinery has not yet been hooked up to thesestreams just yet. The
std::fmt::outputmodule has also not yet beenimplemented as part of this commit.