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

Use IntoIterator instead of Vec for tabs #254

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

barskern
Copy link
Contributor

@barskern barskern commented Jul 3, 2024

I have an app where I create the list of tabs at runtime through the use of an iterator. The allocation of a Vec which is then immediately iterated upon seemed a bit wasteful. If there was a reason for the particular API, please do tell. If not, here is a simple change which changes the function to accept any IntoIterator, which would then avoid this allocation in my case. Further, the existing interface should be preserved, as Vec implements IntoIterator, in addition to that the size_hit will return the length of the Vec.

Thank you for a great couple of widgets in this library!

Copy link
Collaborator

@genusistimelord genusistimelord left a comment

Choose a reason for hiding this comment

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

Looks good, it should be this. I have not really focused on updating iced_aw much, since most of the widgets are made by other people. I just try to keep it updated to iced itself.

@genusistimelord genusistimelord merged commit dfa670d into iced-rs:main Jul 3, 2024
2 checks passed
@barskern barskern deleted the tabs-prevent-allocation branch July 3, 2024 12:57
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.

2 participants