Skip to content

Commit

Permalink
Remove unneeded trait lifetime in geo-traits (#253)
Browse files Browse the repository at this point in the history
* Remove lifetime from trait

* Remove unneeded trait lifetime in geo-traits

* lint
  • Loading branch information
kylebarron authored Nov 17, 2023
1 parent 03275be commit 42ab6cd
Show file tree
Hide file tree
Showing 54 changed files with 725 additions and 534 deletions.
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions src/algorithm/native/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ pub fn point_eq<T: CoordFloat>(
}

#[inline]
pub fn line_string_eq<'a, T: CoordFloat>(
left: impl LineStringTrait<'a, T = T>,
right: impl LineStringTrait<'a, T = T>,
pub fn line_string_eq<T: CoordFloat>(
left: impl LineStringTrait<T = T>,
right: impl LineStringTrait<T = T>,
) -> bool {
if left.num_coords() != right.num_coords() {
return false;
Expand All @@ -68,9 +68,9 @@ pub fn line_string_eq<'a, T: CoordFloat>(
}

#[inline]
pub fn polygon_eq<'a, T: CoordFloat>(
left: impl PolygonTrait<'a, T = T>,
right: impl PolygonTrait<'a, T = T>,
pub fn polygon_eq<T: CoordFloat>(
left: impl PolygonTrait<T = T>,
right: impl PolygonTrait<T = T>,
) -> bool {
if left.num_interiors() != right.num_interiors() {
return false;
Expand Down Expand Up @@ -101,9 +101,9 @@ pub fn polygon_eq<'a, T: CoordFloat>(
}

#[inline]
pub fn multi_point_eq<'a, T: CoordFloat>(
left: impl MultiPointTrait<'a, T = T>,
right: impl MultiPointTrait<'a, T = T>,
pub fn multi_point_eq<T: CoordFloat>(
left: impl MultiPointTrait<T = T>,
right: impl MultiPointTrait<T = T>,
) -> bool {
if left.num_points() != right.num_points() {
return false;
Expand All @@ -121,9 +121,9 @@ pub fn multi_point_eq<'a, T: CoordFloat>(
}

#[inline]
pub fn multi_line_string_eq<'a, T: CoordFloat>(
left: impl MultiLineStringTrait<'a, T = T>,
right: impl MultiLineStringTrait<'a, T = T>,
pub fn multi_line_string_eq<T: CoordFloat>(
left: impl MultiLineStringTrait<T = T>,
right: impl MultiLineStringTrait<T = T>,
) -> bool {
if left.num_lines() != right.num_lines() {
return false;
Expand All @@ -139,9 +139,9 @@ pub fn multi_line_string_eq<'a, T: CoordFloat>(
}

#[inline]
pub fn multi_polygon_eq<'a, T: CoordFloat>(
left: impl MultiPolygonTrait<'a, T = T>,
right: impl MultiPolygonTrait<'a, T = T>,
pub fn multi_polygon_eq<T: CoordFloat>(
left: impl MultiPolygonTrait<T = T>,
right: impl MultiPolygonTrait<T = T>,
) -> bool {
if left.num_polygons() != right.num_polygons() {
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/array/binary/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<O: OffsetSizeTrait> MutableWKBArray<O> {
///
/// It is expected to be considerably faster if you convert whole geometry arrays at a time.
/// E.g. using the `From` implementation from LineStringArray.
pub fn push_line_string<'a>(&mut self, geom: impl LineStringTrait<'a, T = f64>) {
pub fn push_line_string(&mut self, geom: impl LineStringTrait<T = f64>) {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(line_string_wkb_size(&geom));
write_line_string_as_wkb(&mut buf, &geom).unwrap();
Expand All @@ -84,7 +84,7 @@ impl<O: OffsetSizeTrait> MutableWKBArray<O> {
///
/// It is expected to be considerably faster if you convert whole geometry arrays at a time.
/// E.g. using the `From` implementation from PolygonArray.
pub fn push_polygon<'a>(&mut self, geom: impl PolygonTrait<'a, T = f64>) {
pub fn push_polygon(&mut self, geom: impl PolygonTrait<T = f64>) {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(polygon_wkb_size(&geom));
write_polygon_as_wkb(&mut buf, &geom).unwrap();
Expand All @@ -97,7 +97,7 @@ impl<O: OffsetSizeTrait> MutableWKBArray<O> {
///
/// It is expected to be considerably faster if you convert whole geometry arrays at a time.
/// E.g. using the `From` implementation from MultiPointArray.
pub fn push_multi_point<'a>(&mut self, geom: impl MultiPointTrait<'a, T = f64>) {
pub fn push_multi_point(&mut self, geom: impl MultiPointTrait<T = f64>) {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(multi_point_wkb_size(&geom));
write_multi_point_as_wkb(&mut buf, &geom).unwrap();
Expand All @@ -110,7 +110,7 @@ impl<O: OffsetSizeTrait> MutableWKBArray<O> {
///
/// It is expected to be considerably faster if you convert whole geometry arrays at a time.
/// E.g. using the `From` implementation from MultiLineStringArray.
pub fn push_multi_line_string<'a>(&mut self, geom: impl MultiLineStringTrait<'a, T = f64>) {
pub fn push_multi_line_string(&mut self, geom: impl MultiLineStringTrait<T = f64>) {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(multi_line_string_wkb_size(&geom));
write_multi_line_string_as_wkb(&mut buf, &geom).unwrap();
Expand All @@ -123,7 +123,7 @@ impl<O: OffsetSizeTrait> MutableWKBArray<O> {
///
/// It is expected to be considerably faster if you convert whole geometry arrays at a time.
/// E.g. using the `From` implementation from MultiPolygonArray.
pub fn push_multi_polygon<'a>(&mut self, geom: impl MultiPolygonTrait<'a, T = f64>) {
pub fn push_multi_polygon(&mut self, geom: impl MultiPolygonTrait<T = f64>) {
// TODO: figure out how to write directly to the underlying vec without a copy
let mut buf = Vec::with_capacity(multi_polygon_wkb_size(&geom));
write_multi_polygon_as_wkb(&mut buf, &geom).unwrap();
Expand Down
20 changes: 10 additions & 10 deletions src/array/linestring/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ use std::sync::Arc;
/// Converting a [`MutableLineStringArray`] into a [`LineStringArray`] is `O(1)`.
#[derive(Debug)]
pub struct MutableLineStringArray<O: OffsetSizeTrait> {
coords: MutableCoordBuffer,
pub(crate) coords: MutableCoordBuffer,

/// Offsets into the coordinate array where each geometry starts
geom_offsets: OffsetsBuilder<O>,
pub(crate) geom_offsets: OffsetsBuilder<O>,

/// Validity is only defined at the geometry level
validity: NullBufferBuilder,
pub(crate) validity: NullBufferBuilder,
}

impl<'a, O: OffsetSizeTrait> MutableLineStringArray<O> {
impl<O: OffsetSizeTrait> MutableLineStringArray<O> {
/// Creates a new empty [`MutableLineStringArray`].
pub fn new() -> Self {
Self::with_capacities(0, 0)
Expand Down Expand Up @@ -112,7 +112,7 @@ impl<'a, O: OffsetSizeTrait> MutableLineStringArray<O> {
/// This function errors iff the new last item is larger than what O supports.
pub fn push_line_string(
&mut self,
value: Option<&impl LineStringTrait<'a, T = f64>>,
value: Option<&impl LineStringTrait<T = f64>>,
) -> Result<()> {
if let Some(line_string) = value {
let num_coords = line_string.num_coords();
Expand Down Expand Up @@ -148,7 +148,7 @@ impl<'a, O: OffsetSizeTrait> MutableLineStringArray<O> {
}

#[inline]
fn push_null(&mut self) {
pub(crate) fn push_null(&mut self) {
self.geom_offsets.extend_constant(1);
self.validity.append(false);
}
Expand Down Expand Up @@ -186,8 +186,8 @@ impl<O: OffsetSizeTrait> From<MutableLineStringArray<O>> for GenericListArray<O>
}
}

pub(crate) fn first_pass<'a>(
geoms: impl Iterator<Item = Option<impl LineStringTrait<'a>>>,
pub(crate) fn first_pass(
geoms: impl Iterator<Item = Option<impl LineStringTrait>>,
geoms_length: usize,
) -> (usize, usize) {
let mut coord_capacity = 0;
Expand All @@ -200,8 +200,8 @@ pub(crate) fn first_pass<'a>(
(coord_capacity, geom_capacity)
}

pub(crate) fn second_pass<'a, O: OffsetSizeTrait>(
geoms: impl Iterator<Item = Option<impl LineStringTrait<'a, T = f64>>>,
pub(crate) fn second_pass<O: OffsetSizeTrait>(
geoms: impl Iterator<Item = Option<impl LineStringTrait<T = f64>>>,
coord_capacity: usize,
geom_capacity: usize,
) -> MutableLineStringArray<O> {
Expand Down
Loading

0 comments on commit 42ab6cd

Please sign in to comment.