-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
f0414a9
to
6c67764
Compare
@@ -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 |
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 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. |
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.
"when the end of the input"?
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.
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 |
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.
Same, the sentence is too long.
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. |
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.
"Note that reading updates the slice to point to the yet unread part."? (I removed "just")
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.
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. |
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.
Same as above.
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.
Updated with the squash. Thanks for the help. |
📌 Commit 9568f44 has been approved by |
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.
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.