# `MultiArrayList`
**Experimental**: Only a small subset of the array list API is implemented.
---
A `MultiArrayList` stores a list of a struct.
> Instead of storing a single list of items, `MultiArrayList` stores separate lists for each field of the struct.
> This allows for memory savings if the struct has padding,
> and also improves cache usage if only some fields are needed for a computation.
The primary API for accessing fields is the [`items::<NAME>()`][`MultiArrayList::items()`] function.
---
_inspired by [Zig's `MultiArrayList`](https://ziglang.org/documentation/master/std/#std.MultiArrayList)._
# Example
```rust
use multi_array_list::MultiArrayList;
struct Pizza {
radius: u32,
toppings: Vec<Topping>,
}
enum Topping {
Tomato,
Mozzarella,
Anchovies,
}
let mut order = MultiArrayList::<Pizza>::new();
let margherita = Pizza {
radius: 12,
toppings: vec![Topping::Tomato],
};
order.push(margherita);
let napoli = Pizza {
radius: 12,
toppings: vec![Topping::Tomato, Topping::Anchovies],
};
order.push(napoli);
for topping in order.items_mut::<"toppings", Vec<Topping>>() {
topping.push(Topping::Mozzarella);
}
```
## License
MIT. See [LICENSE](LICENSE).