onflow / atree

Atree provides scalable arrays and scalable ordered maps.
https://onflow.org
Apache License 2.0
40 stars 16 forks source link

Add range iteration with Array.IterateRange #238

Closed fxamacker closed 2 years ago

fxamacker commented 2 years ago

Closes #237

Description

Add Array.IterateRange and Array.RangeIterator for range iteration with start index and end index.

Return SliceOutOfBoundsError when start index and/or end index is out of bounds.

Return InvalidSliceIndexError when start index > end index. This can happen even if range is within bounds.


codecov-commenter commented 2 years ago

Codecov Report

Merging #238 (4d37565) into main (b18c369) will increase coverage by 0.10%. The diff coverage is 77.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   68.56%   68.66%   +0.10%     
==========================================
  Files          14       14              
  Lines        7129     7222      +93     
==========================================
+ Hits         4888     4959      +71     
- Misses       1613     1629      +16     
- Partials      628      634       +6     
Impacted Files Coverage Δ
errors.go 14.72% <50.00%> (+2.33%) :arrow_up:
array.go 75.99% <80.00%> (-0.04%) :arrow_down:
map.go 71.41% <0.00%> (+0.10%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b18c369...4d37565. Read the comment docs.