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

feat: Add enums exercises #224

Merged
merged 1 commit into from
Nov 9, 2019
Merged

feat: Add enums exercises #224

merged 1 commit into from
Nov 9, 2019

Conversation

nyxtom
Copy link
Contributor

@nyxtom nyxtom commented Oct 28, 2019

Creates an exhaustive list of enum exercises. This goes through the basics of different ways to derive enums with mixed data type variants, as well as the use of the all important match operator.

@nyxtom nyxtom force-pushed the feat-enums branch 3 times, most recently from 9ca2030 to a60d34e Compare October 28, 2019 19:20
Copy link
Member

@shadows-withal shadows-withal left a comment

Choose a reason for hiding this comment

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

Fundamentally it's a good idea, but I don't think having IP address kind as a reference enum is a good idea, since not all people might be familiar with it. Why not go for the Coin example for all exercises?

Also, I noticed there's two enums PRs now, so I'll cc @xmaayy on this just to be sure. If the feedback here gets addressed and there's nothing else, I'll merge this one since the other one doesn't seem to be active.

@bors
Copy link
Contributor

bors commented Oct 28, 2019

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

@bors bors added the S-waiting-on-author Status: Waiting on issue/PR author label Oct 28, 2019
@nyxtom
Copy link
Contributor Author

nyxtom commented Oct 29, 2019

I’ll go ahead and update the exercises. Though the book itself uses ipaddr and ipkind as a point of interest (this is mainly what I followed here).

Note the use of IpAddr/IpKind here https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html

@nyxtom
Copy link
Contributor Author

nyxtom commented Oct 29, 2019

@fmoko I ended up just simplifying the implementations to just stick with the Message enumeration example since it's the most consistent use case (i.e. commands).

@nyxtom
Copy link
Contributor Author

nyxtom commented Oct 29, 2019

Does @bors need to rerun to remove the label waiting-on-author?

@shadows-withal shadows-withal removed the S-waiting-on-author Status: Waiting on issue/PR author label Oct 30, 2019
@shadows-withal
Copy link
Member

Merging this now.

@bors: r+

@bors
Copy link
Contributor

bors commented Nov 9, 2019

📌 Commit dc15032 has been approved by fmoko

@bors
Copy link
Contributor

bors commented Nov 9, 2019

⌛ Testing commit dc15032 with merge c6dad28...

bors added a commit that referenced this pull request Nov 9, 2019
feat: Add enums exercises

Creates an exhaustive list of enum exercises. This goes through the basics of different ways to derive enums with mixed data type variants, as well as the use of the all important `match` operator.
@bors
Copy link
Contributor

bors commented Nov 9, 2019

☀️ Test successful - checks-travis
Approved by: fmoko
Pushing c6dad28 to master...

@bors bors merged commit dc15032 into rust-lang:master Nov 9, 2019
@bors bors mentioned this pull request Nov 9, 2019
@nyxtom nyxtom deleted the feat-enums branch November 9, 2019 22:55
ppp3 pushed a commit to ppp3/rustlings that referenced this pull request May 23, 2022
feat: Add enums exercises

Creates an exhaustive list of enum exercises. This goes through the basics of different ways to derive enums with mixed data type variants, as well as the use of the all important `match` operator.
dmoore04 pushed a commit to dmoore04/rustlings that referenced this pull request Sep 11, 2022
feat: Add enums exercises

Creates an exhaustive list of enum exercises. This goes through the basics of different ways to derive enums with mixed data type variants, as well as the use of the all important `match` operator.
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.

3 participants