-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add method map() on Children to wrap easily #3039
Add method map() on Children to wrap easily #3039
Conversation
Visit the preview URL for this PR (updated for commit afcce29): https://yew-rs-api--pr3039-add-convient-helper-dsruq0op.web.app (expires Tue, 20 Dec 2022 15:39:28 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition!
Side note: the example in the PR description is wrong. The closure passed to map
should provide children as a parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me too! I'm not 100% on board with the name (cause map
on an iterator-like thing might mean per-item), but I can't think of a better name, and it's consistent with Option
, so 👍 from me.
@WorldSEnder I have the same doubt to be honest but I couldn't find a better name. There is Option::and_then. But I think it doesn't sound as good as map here. The actual map on iterator can still be done with (I'm merging this for now but I will create another PR if we come up with a better name) |
Description
Add a function
Children::map(&self)
to easily wrap children.Real life example:
This can be simplified into:
Checklist