Skip to content

Commit

Permalink
Comment out Index method on bitvecs. See issue #1 for when we can ree…
Browse files Browse the repository at this point in the history
…nable
  • Loading branch information
Roderick Bovee committed Aug 4, 2017
1 parent 048c283 commit 16b8169
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/bitvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,20 +301,24 @@ impl Drop for BitVec {
}
}

impl Index<usize> for BitVec {
// fairly hacky; it would be nice to have Index<Range>, IndexMut<usize>,
// and IndexMut<Range> methods too, but since these have to return
// references that's a little tricky
type Output = bool;
fn index(&self, idx: usize) -> &Self::Output {
const TRUE: &'static bool = &true;
const FALSE: &'static bool = &false;
match self.get(idx) {
true => TRUE,
false => FALSE,
}
}
}
// In addition to being slower than the `get` method itself, the below is
// essentially useless as we don't have an equivalent "setter" method.
// See issue #1 for more details as to why.
//
// impl Index<usize> for BitVec {
// // fairly hacky; it would be nice to have Index<Range>, IndexMut<usize>,
// // and IndexMut<Range> methods too, but since these have to return
// // references that's a little tricky
// type Output = bool;
// fn index(&self, idx: usize) -> &Self::Output {
// const TRUE: &'static bool = &true;
// const FALSE: &'static bool = &false;
// match self.get(idx) {
// true => TRUE,
// false => FALSE,
// }
// }
// }


#[test]
Expand Down

0 comments on commit 16b8169

Please sign in to comment.