pub struct MultiPolygonBuilder { /* private fields */ }
Expand description
The GeoArrow equivalent to Vec<Option<MultiPolygon>>
: a mutable collection of MultiPolygons.
Converting an MultiPolygonBuilder
into a MultiPolygonArray
is O(1)
.
Implementations§
Source§impl MultiPolygonBuilder
impl MultiPolygonBuilder
Sourcepub fn new(typ: MultiPolygonType) -> Self
pub fn new(typ: MultiPolygonType) -> Self
Creates a new empty MultiPolygonBuilder
.
Sourcepub fn with_capacity(
typ: MultiPolygonType,
capacity: MultiPolygonCapacity,
) -> Self
pub fn with_capacity( typ: MultiPolygonType, capacity: MultiPolygonCapacity, ) -> Self
Creates a new MultiPolygonBuilder
with a capacity.
Sourcepub fn reserve(&mut self, additional: MultiPolygonCapacity)
pub fn reserve(&mut self, additional: MultiPolygonCapacity)
Reserves capacity for at least additional
more MultiPolygons.
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: MultiPolygonCapacity)
pub fn reserve_exact(&mut self, additional: MultiPolygonCapacity)
Reserves the minimum capacity for at least additional
more MultiPolygons.
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) -> MultiPolygonArray
pub fn finish(self) -> MultiPolygonArray
Consume the builder and convert to an immutable MultiPolygonArray
Sourcepub fn push_polygon(
&mut self,
value: Option<&impl PolygonTrait<T = f64>>,
) -> GeoArrowResult<()>
pub fn push_polygon( &mut self, value: Option<&impl PolygonTrait<T = f64>>, ) -> GeoArrowResult<()>
Add a new Polygon to the end of this array.
§Errors
This function errors iff the new last item is larger than what O supports.
Sourcepub fn push_multi_polygon(
&mut self,
value: Option<&impl MultiPolygonTrait<T = f64>>,
) -> GeoArrowResult<()>
pub fn push_multi_polygon( &mut self, value: Option<&impl MultiPolygonTrait<T = f64>>, ) -> GeoArrowResult<()>
Add a new MultiPolygon to the end of this array.
§Errors
This function errors iff the new last item is larger than what O supports.
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 Polygon or MultiPolygon.
Sourcepub fn extend_from_iter<'a>(
&mut self,
geoms: impl Iterator<Item = Option<&'a (impl MultiPolygonTrait<T = f64> + 'a)>>,
)
pub fn extend_from_iter<'a>( &mut self, geoms: impl Iterator<Item = Option<&'a (impl MultiPolygonTrait<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 unsafe fn push_coord(
&mut self,
coord: &impl CoordTrait<T = f64>,
) -> GeoArrowResult<()>
pub unsafe fn push_coord( &mut self, coord: &impl CoordTrait<T = f64>, ) -> GeoArrowResult<()>
Push a raw coordinate to the underlying coordinate array.
§Safety
This is marked as unsafe because care must be taken to ensure that pushing raw coordinates to the array upholds the necessary invariants of the array.
Sourcepub fn from_multi_polygons(
geoms: &[impl MultiPolygonTrait<T = f64>],
typ: MultiPolygonType,
) -> Self
pub fn from_multi_polygons( geoms: &[impl MultiPolygonTrait<T = f64>], typ: MultiPolygonType, ) -> Self
Construct a new builder, pre-filling it with the provided geometries
Sourcepub fn from_nullable_multi_polygons(
geoms: &[Option<impl MultiPolygonTrait<T = f64>>],
typ: MultiPolygonType,
) -> Self
pub fn from_nullable_multi_polygons( geoms: &[Option<impl MultiPolygonTrait<T = f64>>], typ: MultiPolygonType, ) -> Self
Construct a new builder, pre-filling it with the provided geometries
Sourcepub fn from_nullable_geometries(
geoms: &[Option<impl GeometryTrait<T = f64>>],
typ: MultiPolygonType,
) -> GeoArrowResult<Self>
pub fn from_nullable_geometries( geoms: &[Option<impl GeometryTrait<T = f64>>], typ: MultiPolygonType, ) -> GeoArrowResult<Self>
Construct a new builder, pre-filling it with the provided geometries