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

substring search #583

Closed
BurntSushi opened this issue Mar 30, 2017 · 3 comments
Closed

substring search #583

BurntSushi opened this issue Mar 30, 2017 · 3 comments

Comments

@BurntSushi
Copy link
Member

BurntSushi commented Mar 30, 2017

Both versions of the book cover strings in a fair amount of detail, but one piece missing is substring searching. In particular, there are a lot of methods on the primitive str type that do various kinds of substring searching, whether it be testing the existence of a substring, finding its position, or just iterating over matches. In addition to this, many of said methods are generic on the Pattern trait, which might be a bit overwhelming to beginners, and therefore benefit greatly from a more cohesive explanation in the book.

The second version of the book has an excellent section on building a grep, but the focus is (rightly) more about building a project rather than exploring the particulars of substring search.

Popping up a level, I think there's some good motivation for making simple substring search in Rust a bit more discoverable. In particular, searching for substring in std's API docs doesn't turn up any specific methods for doing substring search. Even googling rust substring search doesn't turn up much that's useful to beginners in the first few results.

There's at least one documented case of someone getting lost enough to wind up on the issue tracker of a crate that is way overkill for the problem of simple substring search.


I'd be interested in helping to improve this situation. But I don't quite know what the process is.

@BurntSushi
Copy link
Member Author

But I don't quite know what the process is.

Errm, by this, I mean:

  • Is it desirable to have something like this in the book?
  • If so, should it go in the section on Strings? What if the section doubles in size because of that? Is that OK?
  • Would it be better to just publish a blog post and let that trickle back into the book?

@carols10cents
Copy link
Member

Yeaaaahhhh sooo...

Is it desirable to have something like this in the book?

Possibly! I'm not sure yet :)

If so, should it go in the section on Strings? What if the section doubles in size because of that? Is that OK?

Soooo the problem is the process we're going through with No Starch to print the book. I'm not sure if by "the section on Strings" you're referring to Chapter 4 (more on string slices) or Chapter 8 (on String), but chapter 4 is frozen at this point and chapter 8 is in the queue for copy editing. Basically we're not supposed to be making large changes to either of those at this point.... so no, that wouldn't be ok :(

Would it be better to just publish a blog post and let that trickle back into the book?

I think that would probably be better, yeah :)

@carols10cents
Copy link
Member

I'm gonna give this a close :) ❤️

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

No branches or pull requests

2 participants