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 MasterDetails
Pull RequestDetails
|
Size ComparisonDetails
✅ None of the examples has changed their size significantly. |
ranile
left a comment
There was a problem hiding this comment.
Good addition!
Side note: the example in the PR description is wrong. The closure passed to map should provide children as a parameter
WorldSEnder
left a comment
There was a problem hiding this comment.
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