# qindex_multi
### [API Documentation](http://qrlpx.github.io/qindex_multi/qindex_multi)
This crate provides `MultiIndexable`, through which its implementors allow us to violate basic borrowing-rules when indexing them (using `Index[Mut]`) , as long as we adhere to them for each individual element.
In other words:
We can index a collection mutably and immutable multiple times at once, as long as there are no read/write clashes.
NOTE: `MultiIndexable` is currently not implemented for libstd's `HashMap` and `BTreeMap`, due to them missing `IndexMut`-implementations. This will change when `IndexAssign`-functionality lands.
This crate requires the latest rust nightly to compile.
## TODO
* Doc, Tests, Examples
## Example Usage
```rust
#![feature(slice_patterns)]
extern crate qcollect;
extern crate qindex_multi;
extern crate vec_map;
use vec_map::VecMap;
use qindex_multi::{MultiIndexable, MultiIndex};
#[test]
fn test1(){
let mut data = VecMap::new();
data.insert(0, 100u16);
data.insert(2, 200);
data.insert(20, 300);
data.insert(200, 400);
let read_indicies = vec![0, 2, 20];
let write_indicies = vec![200];
let multi_idx = MultiIndex::new(read_indicies, write_indicies);
{
let mut output = data.index_multi(&multi_idx);
let [a, b, c]: [_; 3] = qcollect::iter_into_fixed(output.read);
let d = output.write.next().unwrap();
*d += *a + *b + c;
}
assert_eq!(data[200], 1000);
}
```