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

Changes a little the description of take in the guide #18273

Merged
merged 1 commit into from Oct 28, 2014

Conversation

gamazeps
Copy link
Contributor

Closes #18218

@huonw
Copy link
Member

huonw commented Oct 24, 2014

I think this phrasing is better, but the first part of the sentence is still too active: take does not "get the first n elements" out of the iterator, it returns the old iterator, cutting off the stream after n items have been yielded. In particular, it doesn't touch next or consume anything until next is called: let _ = iter.take(n); does no iteration or mutation.

@steveklabnik
Copy link
Member

@huonw 👍

@gamazeps
Copy link
Contributor Author

@huonw better ?

There are tons of interesting iterator adapters. `take(n)` will get the
first `n` items out of an iterator, and return them as a list. Let's
try it out with our infinite iterator from before, `count()`:
There are tons of interesting iterator adapters. `take(n)` will give away an
Copy link
Member

Choose a reason for hiding this comment

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

give away?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, return is better :p

@gamazeps
Copy link
Contributor Author

@steveklabnik better ?

@gamazeps
Copy link
Contributor Author

r?

@steveklabnik
Copy link
Member

Thanks. Editing is the worst, sorry there was so much churn over such a small change.

bors added a commit that referenced this pull request Oct 28, 2014
@gamazeps
Copy link
Contributor Author

@steveklabnik No problem :)
It didn't take that long (writting and waiting for review is asynchronous :p ) anyway.

If you want a hand on more edits in the doc I'm here :)

@bors bors closed this Oct 28, 2014
@bors bors merged commit b4697f0 into rust-lang:master Oct 28, 2014
@gamazeps gamazeps deleted the issue18218 branch May 7, 2017 14:52
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.

rust guide: take() confusingly described as returning a list
4 participants