Repository navigation
Add into_scalar method for Array0 - #535
Merged
Merged
Conversation
jturner314
force-pushed
the
array0-into-scalar
branch
from
November 11, 2018 21:39
cb05c2e to
6273494
Compare
jturner314
force-pushed
the
array0-into-scalar
branch
2 times, most recently
from
November 12, 2018 03:58
356204b to
d859202
Compare
Member
|
This would avoid using the |
bluss
reviewed
Nov 14, 2018
| let index = (first - base) / size; | ||
| debug_assert_eq!((first - base) % size, 0); | ||
| // Remove the element at that index and return it. | ||
| self.data.0.remove(index) |
Member
There was a problem hiding this comment.
Gnarly but it works fine. Maybe a comment to explain that the len of the Vec might be bigger than the array's current len
Member
Author
There was a problem hiding this comment.
Okay, I've added a explanatory comment. If someone changes the implementation in the future, the test will also help catch this edge case.
jturner314
force-pushed
the
array0-into-scalar
branch
from
November 14, 2018 19:08
d859202 to
60d3b97
Compare
Member
Author
|
Do you think it would make sense to add |
Member
Author
|
Never mind. I think |
bluss
approved these changes
Nov 14, 2018
This was referenced Nov 14, 2018
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.
Other possible names:
into_first,into_inner,unwrap.Edit: I just realized the implementation is broken and I need to fix it. Don't merge this yet!
Edit2: Fixed now! (See the first part of the
array0_into_scalartest for the case where my original implementation was broken.)