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

Implement Iterator for StorageVec #6821

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ironcev
Copy link
Member

@ironcev ironcev commented Jan 8, 2025

Description

This PR implements Iterator for StorageVec.

Iterating over a StorageVec via for loop should now be the preferred option. Compared to the traversal via while loop and incrementing index, the for loop is:

  • more performant. for loop eliminates the redundant boundary checks done in every get() call in the while loop.
  • more idiomatic and convenient.

Closes #6796.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@ironcev ironcev self-assigned this Jan 8, 2025
@ironcev ironcev added the lib: std Standard library label Jan 8, 2025
@ironcev ironcev requested review from bitzoic and IGI-111 January 8, 2025 12:08
@ironcev ironcev marked this pull request as ready for review January 11, 2025 00:10
@ironcev ironcev requested review from a team as code owners January 11, 2025 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib: std Standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Iter for StorageVec
2 participants