Repository navigation
Support double-ended network iteration - #234
Merged
achanda merged 1 commit intoOct 28, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Network iterators currently cannot be reversed without collecting the addresses first. Implement
DoubleEndedIteratorfor 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_backmethods are absent.Validation:
cargo test --all-featurespasses 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 andgit diff --checkpass. Repository-widecargo fmt --checkreports 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.