Skip to content

Implement Iterator for StorageVec#6821

Merged
IGI-111 merged 9 commits intomasterfrom
ironcev/6796-impl-iterator-for-storage-vec
Jan 14, 2025
Merged

Implement Iterator for StorageVec#6821
IGI-111 merged 9 commits intomasterfrom
ironcev/6796-impl-iterator-for-storage-vec

Conversation

@ironcev
Copy link
Copy Markdown
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 IGI-111 and bitzoic 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
Copy link
Copy Markdown
Member

@bitzoic bitzoic left a comment

Choose a reason for hiding this comment

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

Really good documentation 🚀

@IGI-111 IGI-111 merged commit 4fe6870 into master Jan 14, 2025
@IGI-111 IGI-111 deleted the ironcev/6796-impl-iterator-for-storage-vec branch January 14, 2025 15:18
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

3 participants