Skip to content

Fix BufRead::read_until documentation. #36851

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

Merged
merged 1 commit into from Sep 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,15 +1264,13 @@ pub trait BufRead: Read {
#[stable(feature = "rust1", since = "1.0.0")]
fn consume(&mut self, amt: usize);

/// Read all bytes into `buf` until the delimiter `byte` is reached.
/// Read all bytes into `buf` until the delimiter `byte` or EOF is reached.
///
/// This function will read bytes from the underlying stream until the
/// delimiter or EOF is found. Once found, all bytes up to, and including,
/// the delimiter (if found) will be appended to `buf`.
///
/// If this reader is currently at EOF then this function will not modify
/// `buf` and will return `Ok(n)` where `n` is the number of bytes which
/// were read.
/// If successful, this function will return the total number of bytes read.
///
/// # Errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is confusingly written, but it's the only place where the Ok return is mentioned, can we thus keep some kind of explanation of what the return value Ok(n) means for this method?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some actual description of successful return value, and done similar
change to read_line.

///
Expand Down Expand Up @@ -1315,9 +1313,7 @@ pub trait BufRead: Read {
/// up to, and including, the delimiter (if found) will be appended to
/// `buf`.
///
/// If this reader is currently at EOF then this function will not modify
/// `buf` and will return `Ok(n)` where `n` is the number of bytes which
/// were read.
/// If successful, this function will return the total number of bytes read.
///
/// # Errors
///
Expand Down