-
Notifications
You must be signed in to change notification settings - Fork 13
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
SmallBitVec::range
method (alternative to impl Index<Range<usize>>
)
#11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! One suggested change, below:
src/lib.rs
Outdated
|
||
#[inline] | ||
fn index(&self, i: usize) -> &bool { | ||
&self.vec[i + self.range.start] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should panic when i + start >= end
src/lib.rs
Outdated
/// assert_eq!(r[1], true); | ||
/// ``` | ||
pub fn range(&self, range: Range<usize>) -> VecRange { | ||
VecRange { vec: &self, range } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should panic if either end of the range is greater than self.len()
.
@mbrubeck ready for review |
* Added `range` method for slicing a vector by a range of indices (#11) * Some code cleanup and testing improvements
No description provided.