1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! An immutable, ABI-stable RTree.
//!
//! ### Creation
//!
//! Use [`RTreeBuilder`] to construct an [`RTree`], which allows you to make queries.
//!
//! ### Search
//!
//! Use [`RTreeIndex::search`] to search an RTree given a bounding box query or
//! [`RTreeIndex::neighbors`] to find the nearest neighbors from a point.
//!
//! ### Persisting
//!
//! You can use [`RTree::into_inner`] to access the underlying `Vec<u8>` it contains.
//!
//! ### Recovering the index
//!
//! You can use [`RTreeRef::try_new`] to construct an RTree as a reference on an external byte
//! slice. If you don't know the coordinate type used in the index, you can use
//! [`CoordType::from_buffer`][crate::CoordType::from_buffer] to infer the coordinate type.
//!
//! ### Coordinate types
//!
//! Supported coordinate types implement [`IndexableNum`][crate::IndexableNum]. Note that float
//! `NaN` is not supported and may panic.
//!
//! ### Alternate sorting methods
//!
//! This crate allows for multiple sorting methods, implemented in [`sort`].
//!
//! ## Example
//!
//! ```
//! use geo_index::rtree::{RTreeBuilder, RTreeIndex, RTreeRef};
//! use geo_index::rtree::sort::HilbertSort;
//!
//! // Create an RTree
//! let mut builder = RTreeBuilder::<f64>::new(3);
//! builder.add(0., 0., 2., 2.);
//! builder.add(1., 1., 3., 3.);
//! builder.add(2., 2., 4., 4.);
//! let tree = builder.finish::<HilbertSort>();
//!
//! // Perform a search
//! assert_eq!(tree.search(0.5, 0.5, 1.5, 1.5), vec![0, 1]);
//!
//! // Convert to underlying buffer
//! let buffer = tree.into_inner();
//!
//! // Create tree as a reference onto this buffer
//! let tree_ref = RTreeRef::<f64>::try_new(&buffer).unwrap();
//!
//! // Perform search again
//! assert_eq!(tree_ref.search(0.5, 0.5, 1.5, 1.5), vec![0, 1]);
//! ```
pub use ;
pub use ;
pub use r#traitRTreeIndex;
pub use Node;