pub enum CoordType {
Int8,
UInt8,
Int16,
UInt16,
Int32,
UInt32,
Float32,
Float64,
}
Expand description
An enum over the allowed coordinate types in the spatial index.
This can be used to infer the coordinate type from an existing buffer.
Variants§
Implementations§
Source§impl CoordType
impl CoordType
Sourcepub fn from_buffer<T: AsRef<[u8]>>(data: &T) -> Result<Self, GeoIndexError>
pub fn from_buffer<T: AsRef<[u8]>>(data: &T) -> Result<Self, GeoIndexError>
Infer the CoordType from an existing buffer.
This can be used to discern the generic type to use when constructing an RTreeRef
or
KDTreeRef
.
use geo_index::rtree::RTreeBuilder;
use geo_index::rtree::sort::HilbertSort;
use geo_index::CoordType;
let mut builder = RTreeBuilder::<u32>::new(2);
builder.add(0, 0, 2, 2);
builder.add(1, 1, 3, 3);
let tree = builder.finish::<HilbertSort>();
let coord_type = CoordType::from_buffer(&tree).unwrap();
assert!(matches!(coord_type, CoordType::UInt32));
This method works for both buffers representing RTree or KDTree trees.
Trait Implementations§
impl Copy for CoordType
impl StructuralPartialEq for CoordType
Auto Trait Implementations§
impl Freeze for CoordType
impl RefUnwindSafe for CoordType
impl Send for CoordType
impl Sync for CoordType
impl Unpin for CoordType
impl UnwindSafe for CoordType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more