Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
rstared
rstared::RTreed is a simple Rust
decorator that adds a
passively listening R-tree,
rstar::RTree, to a
large number of common standard library and third-party collection types.
Supported collections
Standard library
HashMap, gated by thestdfeature (enabled by default);HashSet, gated by thestdfeature (enabled by default);BTreeMap, not feature-gated;BTreeSet, not feature-gated;Vec, not feature-gated;VecDeque, not feature-gated.
Third-party types
bidimap::BiBTreeMap, gated by thebidimapfeature, andbidimap::BiHashMap, which is additionally gated by thestdfeature;indexmap::IndexMapandindexmap::IndexSet, gated by theindexmapfeature;rstar::RTree, not feature-gated;stable_vec::StableVec, gated by thestable-vecfeature;thunderdome::Arena, gated by thethunderdomefeature;arrayvec::ArrayVec, gated by thearrayvecfeature;smallvec::SmallVec, gated by thesmallvecfeature;tinyvec::ArrayVecandtinyvec::TinyVec, gated by thetinyvecfeature;- geometry types from
geo/geo-types:LineString,MultiPoint,MultiLineString,MultiPolygon, andGeometryCollectiongated by thegeofeature;
This library is no_std-compatible and has no mandatory third-party
dependencies except for alloc.
Usage
Adding dependency
Add rstared as a dependency to your Cargo.toml together with the features
that gate the collections you are going to use:
[]
= { = "0.14.1", = [
"arrayvec",
"bidimap",
"geo",
"indexmap",
"smallvec",
"stable-vec",
"thunderdome",
"tinyvec",
] }
For the sake of demonstration, all feature flags are enabled in that snippet. Remove those you don't need.
Usage examples
Vec example
Following is a basic usage example on Vec
(examples/vec.rs).
Vec is pushable, so values are added with .push() and keyed by their index:
use ;
use RTreed;
HashMap example
Because Vec invalidates indices upon removal, there is no .remove() method
available for RTreed<Vec<...>. If you want to dynamically remove elements, you
can use a type with stable keys, such as Rust standard library's HashMap and
BTreeMap, like this:
let rect_vec: HashMap<Rectangle<(i32, i32)>> = Vec::new();
let mut rtreed = RTreed::new(rect_vec);
See
examples/hashmap.rs
for a full usage example on HashMap.
Of course, map types are not as fast as Vecs. If you want to retain most
of Vecs performance while still being able to stably remove elements,
consider using third-party collections such as indexmap::IndexMap,
stable_vec::StableVec, thunderdome::Arena -- RTreed can decorate them just
as well.
MultiPolygon example
Following is a usage example on geo's
MultiPolygon
(examples/multipolygon.rs).
To wrap RTreed over MultiPolygon, you need to enable the rstar_0_13
feature on geo-types, so that its element type,
Polygon, implements RTreeObject:
use ;
use AABB;
use RTreed;
Contributing
We welcome issues and pull requests from anyone both to our repository on GitHub.
If you would like rstared to work with a new collection type, please make
a contribution to maplike, which
provides and implements the traits rstared relies on.
Licence
Outbound licence
rstared is dual-licensed as under either of
at your option.
Inbound licence
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you will be dual-licensed as described above, without any additional terms or conditions.