Skip to content

Add an example for FromIterator::from_iter #23816

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 29, 2015

Conversation

frewsxcv
Copy link
Member

No description provided.

@rust-highfive
Copy link
Contributor

r? @huonw

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

@bors
Copy link
Collaborator

bors commented Mar 29, 2015

☔ The latest upstream changes (presumably #23300) made this pull request unmergeable. Please resolve the merge conflicts.

@frewsxcv frewsxcv force-pushed the fromiterator-example branch from b96d6df to b7ae349 Compare March 29, 2015 01:03
@frewsxcv
Copy link
Member Author

/cc @steveklabnik since this is docs related

@Manishearth
Copy link
Member

This looks good to me. r=me with or without the following change:

While we're at it, could we have an example that uses collect()? That is the more common use for FromIterator, eg (vec![1,2,3,4]).map(|x| x*x).collect::<Vec<_>>()

@frewsxcv frewsxcv force-pushed the fromiterator-example branch from b7ae349 to f6d1ad8 Compare March 29, 2015 14:28
@frewsxcv
Copy link
Member Author

@Manishearth How's that?

/// let colors_set = colors_vec.into_iter().collect::<HashSet<&str>>();
/// assert_eq!(colors_set.len(), 3);
/// ```
assert_eq!(colors_set.len(), 3);
Copy link
Member

Choose a reason for hiding this comment

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

this line seems to be a mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. Fixed in latest push

@frewsxcv frewsxcv force-pushed the fromiterator-example branch from f6d1ad8 to 8fe7f1f Compare March 29, 2015 14:32
@Manishearth
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 29, 2015

📌 Commit 8fe7f1f has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Mar 29, 2015

⌛ Testing commit 8fe7f1f with merge c5370be...

@bors
Copy link
Collaborator

bors commented Mar 29, 2015

@bors bors merged commit 8fe7f1f into rust-lang:master Mar 29, 2015
@frewsxcv frewsxcv deleted the fromiterator-example branch October 2, 2016 23:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants