Skip to content

Expose double-ended range iteration - #62

Merged
charliermarsh merged 2 commits into
mainfrom
charlie/expose-double-ended-range-iterator
Jun 28, 2026
Merged

Expose double-ended range iteration#62
charliermarsh merged 2 commits into
mainfrom
charlie/expose-double-ended-range-iterator

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary

Ranges::iter returns a mapped slice iterator that is already double-ended, but its opaque return type only exposes Iterator. Callers that need reverse borrowed traversal therefore have to materialize the segments.

This exposes DoubleEndedIterator in the return type, allowing callers to traverse borrowed range segments in either direction without cloning or allocating while preserving existing forward iteration.

This unblocks allocation-free descending range traversal in astral-sh/uv#20026.

@codspeed-hq

codspeed-hq Bot commented Jun 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing charlie/expose-double-ended-range-iterator (606a945) with main (5f7dbc9)

Open in CodSpeed

@charliermarsh
charliermarsh marked this pull request as ready for review June 28, 2026 21:04
@charliermarsh
charliermarsh marked this pull request as draft June 28, 2026 21:08
@charliermarsh
charliermarsh marked this pull request as ready for review June 28, 2026 21:09
@charliermarsh
charliermarsh requested a review from konstin June 28, 2026 21:09
@konstin
konstin force-pushed the main branch 2 times, most recently from ab4a29a to 5f7dbc9 Compare June 28, 2026 21:31
@charliermarsh
charliermarsh force-pushed the charlie/expose-double-ended-range-iterator branch from f6ec42a to bddd3e5 Compare June 28, 2026 21:34
@charliermarsh
charliermarsh force-pushed the charlie/expose-double-ended-range-iterator branch from bddd3e5 to 606a945 Compare June 28, 2026 21:37
@charliermarsh
charliermarsh merged commit 99953dd into main Jun 28, 2026
11 checks passed
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