-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Significantly improve documentation for the traits in std::io #26924
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
Conversation
43769a8
to
748c437
Compare
/// returning how many bytes were successfully written. | ||
/// Implementors of the `Write` trait are sometimes called 'writers'. | ||
/// | ||
/// Readers are defined by two required methods, `write()` and `flush()`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writers are defined by
/// let mut buffer = try!(OpenOptions::new().write(true).open("foo.txt")); | ||
/// | ||
/// buffer.write(b"some bytes").unwrap(); | ||
/// buffer.flush().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try!
on these operations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and the ones in the below examples)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had made a mental note that 'now that i've converted these things to files i can try instead of unwrap' and then forgot, thanks :)
7f96964
to
0e1b874
Compare
updated some more, and feeling good about it :) |
/// let mut buffer = String::new(); | ||
/// | ||
/// while stdin.read_line(&mut buffer).unwrap() > 0 { | ||
/// if n == 0 { break } // eof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be deleted now
I am as well! Thanks so much @steveklabnik! r=me with just a few last nits |
(travis also failed) |
0e1b874
to
4fb02a3
Compare
@bors: r=alexcrichton rollup |
📌 Commit 4fb02a3 has been approved by |
🎊 |
"Don't seek past end of stream" is mentioned twice in a row. This happened because seeking before offset 0 was previously mentioned there, and was moved to the "errors" section afterwards. Somehow made it through [#26924](https://github.com/rust-lang/rust/pull/26924/files#diff-668f8f358d4a93474b396dcb3727399eR825).
Examples for everything, as well as some cleanup and consistency changes.
r? @alexcrichton