Skip to content

Conversation

Nemo157
Copy link
Contributor

@Nemo157 Nemo157 commented Jul 21, 2018

Also fixes WriteAll, it was broken in the same way as ReadExact in #1083

/// let bytes = await!(reader.read(&mut output[..]))?;
///
/// // This is only guaranteed to be 4 because `&[u8]` is a synchronous
/// // reader, in a real system you could get anywhere from 1 to
Copy link
Contributor

Choose a reason for hiding this comment

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

...reader. In a real system

There should be a period because it's a new sentence

/// # Ok::<(), Box<std::error::Error>>(()) }).unwrap();
/// ```
///
/// ## EOF is hit before `buf` is filled
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe write it as "End of file". Some people might not know the term

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I expanded the earlier "EOF" in this doc-comment to "end of file (EOF)" and left it as shorthand in this heading.

/// {
/// let mut writer = Cursor::new(&mut output[..]);
/// // Note that for `Cursor` the read and write halves share a single
/// // seek position, this may or may not be true for other types that
Copy link
Contributor

Choose a reason for hiding this comment

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

position. This...

/// use std::io::Cursor;
///
/// let mut reader = Cursor::new([1, 2, 3, 4]);
/// let mut buffer = [0, 0, 0, 0, 4, 3, 2, 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

One final tiny thing: Here I'd prefer to not reuse the numbers and instead use different numbers like 5, 6, 7, 8. This makes it more clear what's happening

@MajorBreakfast
Copy link
Contributor

Rebase (again) 🙂

@Nemo157 Nemo157 force-pushed the futures-util-io-examples branch from 66a9b3d to ea11c8d Compare July 21, 2018 13:31
@Nemo157
Copy link
Contributor Author

Nemo157 commented Jul 21, 2018

Rebased and changed the numbers.

@MajorBreakfast MajorBreakfast merged commit 6dea985 into rust-lang:master Jul 21, 2018
@Nemo157 Nemo157 deleted the futures-util-io-examples branch July 21, 2018 13:58
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

Successfully merging this pull request may close these issues.

2 participants