toodee
TooDee is a lightweight and high performance two-dimensional wrapper around a Vec.
Core features
- Raw access to the underlying vector's slice via
data()anddata_mut(). - Creation of performant two-dimensional subsets using
view()andview_mut(). - Get/set specific cells using indexing, e.g.,
toodee[row][col] = val. - Index by row (i.e., row major) to get/set row slices, e.g.,
toodee[row]. - Iteration, any which way -
rows(),rows_mut(),col(),col_mut(),cells(),cells_mut(). no_stdcompliant.- Can create a new
TooDeeVieworTooDeeViewMutdirectly from a&[T]or&mut [T](respectively). insert_col(),remove_col(),insert_row(), andremove_row()implementations with good performance.
Extras
translate_with_wrap()(scroll),flip_rows(), andflip_cols()operations.sort_by_row()andsort_by_col()operations.
TODO
- Robustness - check for zero rows/cols (div/mod, etc.).
- Range operators that return a
TooDeeView[Mut]? - Implement
nth()andnth_back()for FlattenExact. - More documentation, with examples.
tiles(..)andtiles_mut()?- Pathfinding algorithms?
Motivation
Similar libraries do exist, but they lacked either performance, flexibility, or functionality.
Here's a small feature comparison chart:
Goals
- High performance and good flexibility, with the constraint of using a 1-D vector.
- Suitable for use in image processing, but not restricted to this problem domain.
- Provide solid implementations of non-trivial 2D operations.
Non-goals
- GPU integration
Limitations
- Views are not nested for the time being, The only impact is that the
bounds()of a view are always relative to the underlyingTooDeearray.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.