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
use SphericalPoint;
use Hash;
/// Trait for items that can be stored in a [`SpatialIndex`](crate::SpatialIndex).
///
/// Implementors must provide an id and a spherical position.
///
/// ```
/// use sphereql_index::SpatialItem;
/// use sphereql_core::SphericalPoint;
///
/// #[derive(Debug, Clone)]
/// struct MyItem { id: u32, pos: SphericalPoint }
///
/// impl SpatialItem for MyItem {
/// type Id = u32;
/// fn id(&self) -> &u32 { &self.id }
/// fn position(&self) -> &SphericalPoint { &self.pos }
/// }
///
/// let item = MyItem { id: 1, pos: SphericalPoint::new_unchecked(1.0, 0.5, 0.7) };
/// assert_eq!(*item.id(), 1);
/// ```