rstared
rstared::RTreed is a simple Rust
decorator that adds a
passively listening R-tree,
rstar::RTree, to the
following collections:
HashMap, gated by thestdfeature (enabled by default);HashSet, gated by thestdfeature (enabled by default);BTreeMap, not feature-gated;BTreeSet, not feature-gated;stable_vec::StableVec, gated by thestable-vecfeature (example usage: examples/stable_vec.rs);thunderdome::Arena, gated by thethunderdomefeature (example usage: examples/thunderdome.rs).
This library is no_std-compatible and has no mandatory third-party
dependencies except for alloc.
Usage
Basic usage
Add rstared as a dependency to your Cargo.toml together with the features
that gate the collections you are going to use. For example, to use rstared
with stable_vec::StableVec and thunderdome::Arena, write
[]
= { = "0.3", = ["stable-vec", "thunderdome"] }
Following is a basic usage example taken from examples/basic_usage.rs:
use HashMap;
use ;
use ;
Usage on maps with pushing
Some data structures with map semantics also provide a special type of insertion where a value is inserted without specifying a key, which the structure instead automatically generates and returns by itself. This operation is called pushing.
If a supported type has a push interface, you can use it through RTreed by
calling .push(), like this:
rtreed.push('A');
StableVec and thunderdome::Arena are instances of supported pushable maps.
Contributing
We welcome issues and pull requests from anyone both to our canonical repository on Codeberg and to our GitHub mirror.
Licence
undoredo is dual-licensed as under either of
at your option.