pub struct PointBuilder { /* private fields */ }
Expand description
The GeoArrow equivalent to Vec<Option<Point>>
: a mutable collection of Points.
Converting an PointBuilder
into a PointArray
is O(1)
.
Implementations§
Source§impl PointBuilder
impl PointBuilder
Sourcepub fn new(typ: PointType) -> Self
pub fn new(typ: PointType) -> Self
Creates a new empty PointBuilder
.
Sourcepub fn with_capacity(typ: PointType, capacity: usize) -> Self
pub fn with_capacity(typ: PointType, capacity: usize) -> Self
Creates a new PointBuilder
with a capacity.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more points to be inserted
in the given Vec<T>
. The collection may reserve more space to
speculatively avoid frequent reallocations. After calling reserve
,
capacity will be greater than or equal to self.len() + additional
.
Does nothing if capacity is already sufficient.
Sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional
more points.
Unlike reserve
, this will not deliberately over-allocate to speculatively avoid
frequent allocations. After calling reserve_exact
, capacity will be greater than or equal
to self.len() + additional
. Does nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it
requests. Therefore, capacity can not be relied upon to be precisely
minimal. Prefer reserve
if future insertions are expected.
Sourcepub fn finish(self) -> PointArray
pub fn finish(self) -> PointArray
Consume the builder and convert to an immutable PointArray
Sourcepub fn push_coord(&mut self, value: Option<&impl CoordTrait<T = f64>>)
pub fn push_coord(&mut self, value: Option<&impl CoordTrait<T = f64>>)
Add a new coord to the end of this array, interpreting the coord as a non-empty point.
§Panics
- If the added coordinate does not have the same dimension as the point array.
Sourcepub fn push_point(&mut self, value: Option<&impl PointTrait<T = f64>>)
pub fn push_point(&mut self, value: Option<&impl PointTrait<T = f64>>)
Add a new point to the end of this array.
§Panics
- If the added point does not have the same dimension as the point array.
Sourcepub fn try_push_coord(
&mut self,
value: Option<&impl CoordTrait<T = f64>>,
) -> GeoArrowResult<()>
pub fn try_push_coord( &mut self, value: Option<&impl CoordTrait<T = f64>>, ) -> GeoArrowResult<()>
Add a new coord to the end of this array, where the coord is a non-empty point
§Errors
- If the added coordinate does not have the same dimension as the point array.
Sourcepub fn try_push_point(
&mut self,
value: Option<&impl PointTrait<T = f64>>,
) -> GeoArrowResult<()>
pub fn try_push_point( &mut self, value: Option<&impl PointTrait<T = f64>>, ) -> GeoArrowResult<()>
Add a new point to the end of this array.
§Errors
- If the added point does not have the same dimension as the point array.
Sourcepub fn push_empty(&mut self)
pub fn push_empty(&mut self)
Add a valid but empty point to the end of this array.
Sourcepub fn push_geometry(
&mut self,
value: Option<&impl GeometryTrait<T = f64>>,
) -> GeoArrowResult<()>
pub fn push_geometry( &mut self, value: Option<&impl GeometryTrait<T = f64>>, ) -> GeoArrowResult<()>
Add a new geometry to this builder
This will error if the geometry type is not Point or a MultiPoint with length 1.
Sourcepub fn extend_from_iter<'a>(
&mut self,
geoms: impl Iterator<Item = Option<&'a (impl PointTrait<T = f64> + 'a)>>,
)
pub fn extend_from_iter<'a>( &mut self, geoms: impl Iterator<Item = Option<&'a (impl PointTrait<T = f64> + 'a)>>, )
Extend this builder with the given geometries
Sourcepub fn extend_from_geometry_iter<'a>(
&mut self,
geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>,
) -> GeoArrowResult<()>
pub fn extend_from_geometry_iter<'a>( &mut self, geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>, ) -> GeoArrowResult<()>
Extend this builder with the given geometries
Sourcepub fn from_points<'a>(
geoms: impl ExactSizeIterator<Item = &'a (impl PointTrait<T = f64> + 'a)>,
typ: PointType,
) -> Self
pub fn from_points<'a>( geoms: impl ExactSizeIterator<Item = &'a (impl PointTrait<T = f64> + 'a)>, typ: PointType, ) -> Self
Construct a new builder, pre-filling it with the provided geometries
Sourcepub fn from_nullable_points<'a>(
geoms: impl ExactSizeIterator<Item = Option<&'a (impl PointTrait<T = f64> + 'a)>>,
typ: PointType,
) -> Self
pub fn from_nullable_points<'a>( geoms: impl ExactSizeIterator<Item = Option<&'a (impl PointTrait<T = f64> + 'a)>>, typ: PointType, ) -> Self
Construct a new builder, pre-filling it with the provided geometries
Sourcepub fn from_nullable_geometries(
geoms: &[Option<impl GeometryTrait<T = f64>>],
typ: PointType,
) -> GeoArrowResult<Self>
pub fn from_nullable_geometries( geoms: &[Option<impl GeometryTrait<T = f64>>], typ: PointType, ) -> GeoArrowResult<Self>
Construct a new builder, pre-filling it with the provided geometries