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
//! An immutable, ABI-stable K-D Tree.
//!
//! ### Creation
//!
//! Use [`KDTreeBuilder`] to construct an [`KDTree`], which allows you to make queries.
//!
//! ### Search
//!
//! Use [`KDTreeIndex::range`] to search a KDTree given a bounding box query. Use
//! [`KDTreeIndex::within`] to search a KDTree given a point and radius.
//!
//! ### Persisting
//!
//! You can use [`KDTree::into_inner`] to access the underlying `Vec<u8>` it contains.
//!
//! ### Recovering the index
//!
//! You can use [`KDTreeRef::try_new`] to construct a KDTree 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.
//!
//! ## Example
//!
//! ```
//! use geo_index::kdtree::{KDTreeBuilder, KDTreeIndex, KDTreeRef};
//!
//! // Create a KDTree
//! let mut builder = KDTreeBuilder::<f64>::new(3);
//! builder.add(0., 0.);
//! builder.add(1., 1.);
//! builder.add(2., 2.);
//! let tree = builder.finish();
//!
//! // Perform a search
//! assert_eq!(tree.range(0.5, 0.5, 1.5, 1.5), vec![1]);
//!
//! // Convert to underlying buffer
//! let buffer = tree.into_inner();
//!
//! // Create tree as a reference onto this buffer
//! let tree_ref = KDTreeRef::<f64>::try_new(&buffer).unwrap();
//!
//! // Perform search again
//! assert_eq!(tree_ref.range(0.5, 0.5, 1.5, 1.5), vec![1]);
//! ```
pub
pub use ;
pub use ;
pub use r#traitKDTreeIndex;
pub use Node;