Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Expand drain to accept any RangeBounds<usize> #142

Merged
merged 1 commit into from
Aug 7, 2020

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jul 24, 2020

Rather than just RangeFull, this lets us accept any Range* type or
even arbitrary Bound pairs, matching the signature of Vec::drain.

Rather than just `RangeFull`, this lets us accept any `Range*` type or
even arbitrary `Bound` pairs, matching the signature of `Vec::drain`.
@@ -10,3 +11,29 @@ where
{
iterable.into_iter().enumerate()
}

pub(crate) fn simplify_range<R>(range: R, len: usize) -> Range<usize>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will also be useful for #104.

@cuviper
Copy link
Member Author

cuviper commented Aug 7, 2020

I'm going to go ahead and merge this -- the signature should be uncontroversial to match Vec, and it's not a breaking change since we still accept RangeFull as a possibility. We can always iterate on the implementation more later, if needed.

@cuviper cuviper merged commit 8ddc4f1 into indexmap-rs:master Aug 7, 2020
@cuviper cuviper deleted the drain-ranges branch July 18, 2023 02:41
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant