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

Add documentation for Read, Write impls for slices and Vec #37343

Merged
merged 1 commit into from
Oct 28, 2016

Conversation

bluss
Copy link
Member

@bluss bluss commented Oct 22, 2016

The Write imps for &[u8] and Vec are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.

@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@bluss bluss force-pushed the write-doc branch 2 times, most recently from f0414a9 to 6c67764 Compare October 22, 2016 15:12
@@ -147,6 +147,11 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
// =============================================================================
// In-memory buffer implementations

/// Read is implemented for `&[u8]` by copying from the slice.
///
/// Note that each read from the slice updates the slice itself so that after
Copy link
Member

Choose a reason for hiding this comment

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

This sentence is too long and it makes it difficult to read.

///
/// Note that each read from the slice updates the slice itself so that after
/// each read, the slice points only to the yet unread part. The slice will be
/// empty when end of file is reached.
Copy link
Member

Choose a reason for hiding this comment

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

"when the end of the input"?

Copy link
Member Author

Choose a reason for hiding this comment

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

The Read trait calls this situation "end of file" (with quotes) and/or EOF. So I want to keep that terminology. Using either EOF or "end of file" should be good?

/// Write is implemented for `&mut [u8]` by copying into the slice, overwriting
/// its data.
///
/// Note that each write to the slice updates the slice itself so that after
Copy link
Member

Choose a reason for hiding this comment

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

Same, the sentence is too long.

@bluss
Copy link
Member Author

bluss commented Oct 27, 2016

Updated

/// Note that each read from the slice updates the slice itself so that after
/// each read, the slice points only to the yet unread part. The slice will be
/// empty when end of file is reached.
/// Note that reading updates the slice to point to just the yet unread part.
Copy link
Member

Choose a reason for hiding this comment

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

"Note that reading updates the slice to point to the yet unread part."? (I removed "just")

Copy link
Member Author

Choose a reason for hiding this comment

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

done!

/// Note that each write to the slice updates the slice itself so that after
/// each call the slice only points to the yet unoverwritten part. The slice
/// will be empty when it has been completely overwritten.
/// Note that writing updates the slice to point to just the yet unwritten part.
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@GuillaumeGomez
Copy link
Member

Thanks! Now please squash your commits and it's all good. :)

The Write impls for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.
@bluss
Copy link
Member Author

bluss commented Oct 27, 2016

Updated with the squash. Thanks for the help.

@GuillaumeGomez
Copy link
Member

@bluss: thanks to you!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Oct 28, 2016

📌 Commit 9568f44 has been approved by GuillaumeGomez

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 28, 2016
Add documentation for Read, Write impls for slices and Vec

The Write imps for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.
bors added a commit that referenced this pull request Oct 28, 2016
Rollup of 5 pull requests

- Successful merges: #36206, #37343, #37430, #37436, #37441
- Failed merges:
@bors bors merged commit 9568f44 into rust-lang:master Oct 28, 2016
@bluss bluss deleted the write-doc branch October 29, 2016 01:01
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.

5 participants