implement DoubleEndedIterator for ranges + implement more iterator methods#589
Open
Freax13 wants to merge 10 commits into
Open
implement DoubleEndedIterator for ranges + implement more iterator methods#589Freax13 wants to merge 10 commits into
Freax13 wants to merge 10 commits into
Conversation
PageRange::next and PageRangeInclusive::next should panic when the user tries to jump the address range gap.
... except when jumping the address space gap.
98fbf89 to
2700117
Compare
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.
This PR implements
DoubleEndedIteratorforDoubleEndedIteratorforPageRange,PageRangeInclusive,PhysFrameRange, andPhysFrameRangeInclusive. This PR also implementsnth,nth_back, andsize_hintfor the range types.For my use case, I primarily needed an efficient (O(1)) implementation of
PhysFrameRange::nth_backand since I was already working on that, I figured I might as well add implementations for the other range types as well.Implementing the panicking behavior for
PageRange/PageRangeInclusivewas a bit annoying, so I added kani proofs to make sure the implementations behave correctly for all inputs.