Skip to content

Expand drain to accept any RangeBounds<usize> - #142

Merged
cuviper merged 1 commit into
indexmap-rs:masterfrom
cuviper:drain-ranges
Aug 7, 2020
Merged

Expand drain to accept any RangeBounds<usize>#142
cuviper merged 1 commit into
indexmap-rs:masterfrom
cuviper:drain-ranges

Conversation

@cuviper

@cuviper cuviper commented Jul 24, 2020

Copy link
Copy Markdown
Member

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`.
Comment thread src/util.rs
iterable.into_iter().enumerate()
}

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

Copy link
Copy Markdown
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

cuviper commented Aug 7, 2020

Copy link
Copy Markdown
Member Author

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
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.

1 participant