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

Write better module-level and type-level docs for String #30146

Merged
merged 1 commit into from
Dec 2, 2015

Conversation

steveklabnik
Copy link
Member

Part of #29376

@@ -139,7 +324,7 @@ impl String {
/// // some bytes, in a vector
/// let sparkle_heart = vec![240, 159, 146, 150];
///
/// // We know these bytes are valid, so just use `unwrap()`.
/// // We know these bytes are valid, so we'll use `unwrap()`.
Copy link
Member Author

Choose a reason for hiding this comment

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

these two changes were made to bring this example in line with the module-level version, cc #28835

@rust-highfive
Copy link
Contributor

r? @brson

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

//!
//! The `String` type is the most common string type that has ownership over the
//! contents of the string. It has a close relationship with its borrowed
//! counterpoint, the primitive [`str`].
Copy link
Contributor

Choose a reason for hiding this comment

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

s/counterpoint/counterpart/

@steveklabnik steveklabnik force-pushed the doc_string_intro branch 3 times, most recently from 8ccc806 to 85a896d Compare December 1, 2015 19:20
//! length, and a capacity. The pointer points to an internal buffer `String`
//! uses to store its data. The length is the number of elements currently
//! stored in the buffer, and the capacity is the size of the buffer. As such,
//! the length will always be less than or equal to the capacity.
Copy link
Contributor

Choose a reason for hiding this comment

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

"elements" -> "bytes" and "size of the buffer in bytes" perhaps.

@steveklabnik
Copy link
Member Author

@brson updated to address the issues, other than the UTF-8 stuff. I think that's something that will have to come later.

@brson
Copy link
Contributor

brson commented Dec 2, 2015

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 2, 2015

📌 Commit 492f6fc has been approved by brson

///
/// This buffer is always stored on the heap.
///
/// You can look at these with the [`as_ptr()`], [`len()`], and [`capacity()`]
Copy link
Member

Choose a reason for hiding this comment

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

This section is… pretty far away from the “these”. It should either be repeated what “these” are or paragraphs should be reorganised.

@bors
Copy link
Collaborator

bors commented Dec 2, 2015

⌛ Testing commit 492f6fc with merge 37e337a...

bors added a commit that referenced this pull request Dec 2, 2015
@bors bors merged commit 492f6fc into rust-lang:master Dec 2, 2015
@steveklabnik steveklabnik deleted the doc_string_intro branch June 19, 2016 20:31
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.

6 participants