Skip to content

Change type of end field in slices to Bound #480

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jturner314
Copy link
Member

I just noticed the Bound enum in the standard library while I was reading about the new RangeBounds trait. I thought I'd propose switching to the Bound type, now that we have support for inclusive ranges (#467). There is no memory cost to doing this (since Bound<isize> and Option<isize> are the same size). This is a breaking change.

I'm pretty ambivalent about this PR, since Option has the benefit of being more common than Bound and having lots of convenient methods. It's also nice to only have to deal with exclusive end bounds after the Slice/SliceOrIndex is created. So, I'm curious to see what everyone thinks about this change.

Change type of `Slice.end` and `SliceOrIndex::Slice.end` from
`Option<isize>` to `Bound<isize>`.
@jturner314 jturner314 mentioned this pull request Aug 28, 2018
@bluss
Copy link
Member

bluss commented Aug 28, 2018

Pretty ambivalent / I'd decline the complication since we should do this to get the upsides, not just because we can. So with a plan, it could be good.

@jturner314
Copy link
Member Author

Okay, I'll close this. I don't see any significant upsides, so we might as well avoid unnecessary breakage. If we find a specific use-case in the future, we can always make this change then.

@jturner314 jturner314 closed this Aug 28, 2018
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.

2 participants