Skip to content

Support double-ended network iteration - #234

Merged
achanda merged 1 commit into
achanda:masterfrom
omrzk:feat/double-ended-network-iterators-233
Oct 28, 2026
Merged

achanda merged 1 commit into
achanda:masterfrom
omrzk:feat/double-ended-network-iterators-233

Conversation

@omrzk

@omrzk omrzk commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Network iterators currently cannot be reversed without collecting the addresses first. Implement DoubleEndedIterator for the IPv4, IPv6 and enum iterators, so callers can use .rev() and mix front/back reads without allocating. Fixes #233.

Both ends share the remaining range and stop when they meet. Tests cover all 16 front/back consumption patterns for four-address networks, reversed order, singleton zero/maximum addresses, highest IPv4 addresses, and both ends of the full IPv6 range. The new tests fail to compile on the original code because the traits and next_back methods are absent.

Validation: cargo test --all-features passes 80 unit tests, 5 existing integration tests, 5 new tests and 28 doctests (one existing expensive unit test stays ignored). After adding the documentation example, all 29 doctests pass. cargo build, cargo doc, cargo clippy --all-features, targeted rustfmt checks and git diff --check pass. Repository-wide cargo fmt --check reports existing formatting in the benchmarks, schema declaration and JSON tests; none of those lines are changed here.

Existing network bounds and size-hint behavior remain as implemented upstream; this does not address the separate /0 work in #179.

@achanda
achanda merged commit 0a5cf2a into achanda:master Oct 28, 2026
3 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.

Implement DoubleEndedIterator for network iterators

2 participants