Rust: API Docs: std::str

Created on 26 Oct 2015  路  13Comments  路  Source: rust-lang/rust

Part of https://github.com/rust-lang/rust/issues/29329

http://doc.rust-lang.org/std/str/

Here's what needs to be done to close out this issue:

  • [ ] [the module documentation](https://doc.rust-lang.org/std/str/) is fine, but should point out why std::str and the primitive type are different.
  • [ ] [Bytes](https://doc.rust-lang.org/std/str/struct.Bytes.html) should use the same boilerplate as Lines https://github.com/rust-lang/rust/pull/40935#pullrequestreview-30129225
  • [ ] [CharIndices](https://doc.rust-lang.org/std/str/struct.CharIndices.html) has the same issue. https://github.com/rust-lang/rust/pull/40935#pullrequestreview-30129225
  • [ ] [Chars](https://doc.rust-lang.org/std/str/struct.Chars.html) has the same issue. https://github.com/rust-lang/rust/pull/40935#pullrequestreview-30129225
  • [ ] [EncodeUtf16](https://doc.rust-lang.org/std/str/struct.EncodeUtf16.html) has the same issue. https://github.com/rust-lang/rust/pull/40935#pullrequestreview-30129225
  • [ ] [ParseBoolError](https://doc.rust-lang.org/std/str/struct.ParseBoolError.html) should link to the method it comes from.
  • [ ] [SplitWhitespace](https://doc.rust-lang.org/std/str/struct.SplitWhitespace.html) should use the same boilerplate as Lines.
  • [ ] [Utf8Error](https://doc.rust-lang.org/std/str/struct.Utf8Error.html) should link to those functions.
  • [ ] [FromStr](https://doc.rust-lang.org/std/str/trait.FromStr.html) should have an example of implementing it.
  • [ ] [from_utf8](https://doc.rust-lang.org/std/str/fn.from_utf8.html) should link the types it mentions.
  • [ ] [from_utf8_unchecked](https://doc.rust-lang.org/std/str/fn.from_utf8_unchecked.html) should link that &str.
E-help-wanted E-medium E-mentor P-medium T-doc

All 13 comments

As shown in https://github.com/rust-lang/rust/pull/30057, there's a lot of junk there that could be in Pattern instead.

I am happy to mentor anyone who wants to tackle this issue.

Hello! I'd like to give this issue a try.

@TigleyM that'd be great! this issue is very general, so any improvements would be welcome. Let me know if you need any help!

@steveklabnik Shouldn't this remain open? 3 points have been hit on, but the rest of the bullets need to be addressed

Yes, whoops! That was an auto-close from a PR message; gotta be careful with that!

@steveklabnik Can you explain what you mean by "the same boilerplate" in points 2-5? Boilerplate as in the description text or the struct line, or something else? Getting some clarification could get those knocked out in short order

Yes, absolutely!

https://doc.rust-lang.org/std/iter/#structs is the main set of iterators, for Iterator. When I did these docs, I took care to make them all consistent:

https://doc.rust-lang.org/std/iter/struct.Chain.html

An iterator that strings two iterators together.

This struct is created by the chain() method on Iterator. See its documentation for more.

https://doc.rust-lang.org/std/iter/struct.Enumerate.html

An iterator that yields the current count and the element during iteration.

This struct is created by the enumerate() method on Iterator. See its documentation for more.

etc. Bytes and Lines etc don't use this; when I wrote it, I was thinking that Lines would be the right way to go; but looks like Lines is slightly different than the Iterator ones. So we should change all of these to look like the ones in Iterator. Make sense?

Ahhh, so for Lines, it should be something along the lines of:

An iterator over the lines of a string, as string slices.

This struct is created by the lines() method on str. See its documentation for more.

With the proper links to lines() and str as well, yes?

I could run through each of those structs, format them like that, with a commit for each and then do one big pull request for the lot of them if that would be convenient

Exactly. 馃憤

I could run through each of those structs, format them like that, with a commit for each and then do one big pull request for the lot of them if that would be convenient

Sure thing! That'd be great.

I think the last two PRs should take care of the remaining bits of the task list. When they're merged, I think we'll be good to close this issue out!

  • Module documentation (#40682)
  • Bytes should use the same boilerplate as Lines (#40935)
  • CharIndices has the same issue. (#40935)
  • Chars has the same issue. (#40935)
  • EncodeUtf16 has the same issue. (#40935)
  • ParseBoolError should link to the method it comes from. (#40819)
  • SplitWhitespace should use the same boilerplate as Lines. (#40935)
  • Utf8Error should link to those functions. (#40992)
  • FromStr should have an example of implementing it. (#40824)
  • from_utf8 should link the types it mentions. (#40997)
  • from_utf8_unchecked should link that &str. (#40907)

Everything's merged! Good to close @steveklabnik?

Yes! 馃帄

Thank you for all the help!

Was this page helpful?
0 / 5 - 0 ratings