This crate provides a jagged array, i.e. a type that is semantically equivalent to Box<[Box<[T]>]>, but implemented with better memory locality and fewer heap allocations.

Example

```rust extern crate jaggedarray; extern crate streamingiterator; use std::iter::FromIterator; use jaggedarray::Jagged2; use streamingiterator::StreamingIterator;

// Create a jagged array from a vector of vectors let mut a = Jagged2::from_iter(vec![ vec![1, 2, 3], vec![4], vec![], vec![5, 6], ]);

// indexing is done in (row, column) form and supports get and get_mut variants. asserteq!(a[(1, 0)], 4); *a.getmut((1, 0)).unwrap() = 11; assert_eq!(a.get((1, 0)), Some(&11));

// Whole rows can also be accessed and modified asserteq!(a.getrow(3), Some(&[5, 6][..])); a.getrowmut(3).unwrap()[1] = 11; // Note that although elements are modifiable, the structure is not; // items cannot be inserted into rows, nor can new rows be added.

// Iteration via StreamingIterators. See the docs for more detail. let mut iter = a.stream(); while let Some(row) = iter.next() { println!("row: {:?}", row); } ```

Documentation

Documentation can be found on docs.rs

License

The code in this repository is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repository by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.