You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
}
}
}
but there's not way to have a compatible setter and this is gross to start with (and slower than the get( method we already have).
It would be nice to write
bitvec[1] = true
rather thanbitvec.set(1, true)
.This is essentially blocked on:
rust-lang/rfcs#997
The standard library bit vector has a hacky workaround for getting (and no way to set) indices, but this won't work for us for ranges:
https://doc.rust-lang.org/1.2.0/src/collections/bit.rs.html#168-180
The text was updated successfully, but these errors were encountered: