diff --git a/src/reader/coord.rs b/src/reader/coord.rs index 7c3e56b..7fb9003 100644 --- a/src/reader/coord.rs +++ b/src/reader/coord.rs @@ -49,18 +49,21 @@ impl<'a> Coord<'a> { } } + #[inline] fn get_x(&self) -> f64 { let mut reader = Cursor::new(self.buf); reader.set_position(self.offset); reader.read_f64(self.byte_order).unwrap() } + #[inline] fn get_y(&self) -> f64 { let mut reader = Cursor::new(self.buf); reader.set_position(self.offset + F64_WIDTH); reader.read_f64(self.byte_order).unwrap() } + #[inline] fn get_nth_unchecked(&self, n: usize) -> f64 { debug_assert!(n < self.dim.size()); let mut reader = Cursor::new(self.buf); @@ -84,14 +87,17 @@ impl<'a> CoordTrait for Coord<'a> { self.dim.into() } + #[inline] fn nth_or_panic(&self, n: usize) -> Self::T { self.get_nth_unchecked(n) } + #[inline] fn x(&self) -> Self::T { self.get_x() } + #[inline] fn y(&self) -> Self::T { self.get_y() } diff --git a/src/reader/linearring.rs b/src/reader/linearring.rs index 677a83e..0ac10e7 100644 --- a/src/reader/linearring.rs +++ b/src/reader/linearring.rs @@ -59,6 +59,7 @@ impl<'a> WKBLinearRing<'a> { } /// The offset into this buffer of any given coordinate + #[inline] pub fn coord_offset(&self, i: u64) -> u64 { self.offset + 4 + (self.dim.size() as u64 * 8 * i) } @@ -72,10 +73,12 @@ impl<'a> LineStringTrait for WKBLinearRing<'a> { self.dim.into() } + #[inline] fn num_coords(&self) -> usize { self.num_points } + #[inline] unsafe fn coord_unchecked(&self, i: usize) -> Self::CoordType<'_> { Coord::new( self.buf, diff --git a/src/reader/polygon.rs b/src/reader/polygon.rs index 8c86699..f6d8fcc 100644 --- a/src/reader/polygon.rs +++ b/src/reader/polygon.rs @@ -57,10 +57,6 @@ impl<'a> Polygon<'a> { .fold(1 + 4 + 4, |acc, ring| acc + ring.size()) } - pub fn is_empty(&self) -> bool { - self.wkb_linear_rings.len() == 0 - } - pub fn dimension(&self) -> WKBDimension { self.dim }