EmbarkStudios / mirror-mirror

🪞 Powerful reflection library for Rust
Apache License 2.0
79 stars 2 forks source link

Add `LinearMap` and `LinearSet` to `tame-containers` #122

Closed fu5ha closed 1 year ago

fu5ha commented 1 year ago

Does what it says on the tin. Requires #119 first.

LinearMap and LinearSet are map and set types built on top of a Vec by simply doing linear search for key/element. Although this means O(len) scaling on random access operations, it will still likely be faster (and certainly less memory footprint) for small numbers of elements, easy to compare key types, and small element size... which is true in a great many cases!

The implementation is taken from the linear_map crate, but elected to be copied into this repository with a few modifications, since that crate is no longer actively maintained (though it is a good base, as it was written by gankra, the same person that did a lot of the initial work that still stands on the std Vec, VecDeque, and other std containers in Rust).