Skip to content

Conversation

@xunilrj
Copy link
Contributor

@xunilrj xunilrj commented Sep 2, 2025

Description

Continuation of #6860.

This PR implements Iterator trait for arrays, which allows codes like below:

let array: [u64; 3] = [1u64, 2u64, 3u64];
let mut value = 0;
for v in array.iter() {
    value += v;
}
assert(value == 6);

PS: #allow and some unrelated changes demanded by clippy.

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.

@xunilrj xunilrj self-assigned this Sep 2, 2025
@xunilrj xunilrj mentioned this pull request Sep 2, 2025
23 tasks
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 2, 2025

CodSpeed Performance Report

Merging #7370 will not alter performance

Comparing xunilrj/array-iterator (8d5c562) with master (567b5b8)

Summary

✅ 25 untouched benchmarks

@xunilrj xunilrj marked this pull request as ready for review September 3, 2025 12:08
@xunilrj xunilrj requested review from a team as code owners September 3, 2025 12:08
Copy link
Contributor

@tritao tritao left a comment

Choose a reason for hiding this comment

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

Nice work

@IGI-111 IGI-111 enabled auto-merge (squash) September 4, 2025 02:26
Copy link
Contributor

@zees-dev zees-dev left a comment

Choose a reason for hiding this comment

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

Nice; LGTM 👍

@IGI-111 IGI-111 merged commit 6d47ca5 into master Sep 4, 2025
41 checks passed
@IGI-111 IGI-111 deleted the xunilrj/array-iterator branch September 4, 2025 03:10
Elaela22soL pushed a commit to Elaela22soL/sway that referenced this pull request Sep 26, 2025
## Description

Continuation of FuelLabs#6860.

This PR implements `Iterator` trait for arrays, which allows codes like
below:

```sway
let array: [u64; 3] = [1u64, 2u64, 3u64];
let mut value = 0;
for v in array.iter() {
    value += v;
}
assert(value == 6);
```

PS: `#allow` and some unrelated changes demanded by `clippy`.

## Checklist

- [x] I have linked to any relevant issues.
- [x] 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).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] 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.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
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.

5 participants