pub struct GeometryCollectionBuilder { /* private fields */ }
Expand description
The GeoArrow equivalent to Vec<Option<GeometryCollection>>
: a mutable collection of
GeometryCollections.
Converting an GeometryCollectionBuilder
into a GeometryCollectionArray
is O(1)
.
Implementations§
Source§impl<'a> GeometryCollectionBuilder
impl<'a> GeometryCollectionBuilder
Sourcepub fn new(typ: GeometryCollectionType) -> Self
pub fn new(typ: GeometryCollectionType) -> Self
Creates a new empty GeometryCollectionBuilder
.
Sourcepub fn with_capacity(
typ: GeometryCollectionType,
capacity: GeometryCollectionCapacity,
) -> Self
pub fn with_capacity( typ: GeometryCollectionType, capacity: GeometryCollectionCapacity, ) -> Self
Creates a new empty GeometryCollectionBuilder
with the provided
capacity.
Sourcepub fn with_prefer_multi(self, prefer_multi: bool) -> Self
pub fn with_prefer_multi(self, prefer_multi: bool) -> Self
Change whether to prefer multi or single arrays for new single-part geometries.
If true
, a new Point
will be added to the MultiPointBuilder
child array, a new
LineString
will be added to the MultiLineStringBuilder
child array, and a new Polygon
will be added to the MultiPolygonBuilder
child array.
This can be desired when the user wants to downcast the array to a single geometry array
later, as casting to a, say, MultiPointArray
from a GeometryCollectionArray
could be
done zero-copy.
Note that only geometries added after this method is called will be affected.
Sourcepub fn reserve(&mut self, additional: GeometryCollectionCapacity)
pub fn reserve(&mut self, additional: GeometryCollectionCapacity)
Reserves capacity for at least additional
more GeometryCollections.
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: GeometryCollectionCapacity)
pub fn reserve_exact(&mut self, additional: GeometryCollectionCapacity)
Reserves the minimum capacity for at least additional
more GeometryCollections.
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) -> GeometryCollectionArray
pub fn finish(self) -> GeometryCollectionArray
Consume the builder and convert to an immutable GeometryCollectionArray
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<()>
Push a Geometry onto the end of this builder
Sourcepub fn push_geometry_collection(
&mut self,
value: Option<&impl GeometryCollectionTrait<T = f64>>,
) -> GeoArrowResult<()>
pub fn push_geometry_collection( &mut self, value: Option<&impl GeometryCollectionTrait<T = f64>>, ) -> GeoArrowResult<()>
Push a GeometryCollection onto the end of this builder
Sourcepub fn extend_from_iter(
&mut self,
geoms: impl Iterator<Item = Option<&'a (impl GeometryCollectionTrait<T = f64> + 'a)>>,
)
pub fn extend_from_iter( &mut self, geoms: impl Iterator<Item = Option<&'a (impl GeometryCollectionTrait<T = f64> + 'a)>>, )
Extend this builder with the given geometries
Sourcepub fn from_geometry_collections(
geoms: &[impl GeometryCollectionTrait<T = f64>],
typ: GeometryCollectionType,
) -> GeoArrowResult<Self>
pub fn from_geometry_collections( geoms: &[impl GeometryCollectionTrait<T = f64>], typ: GeometryCollectionType, ) -> GeoArrowResult<Self>
Construct a new builder, pre-filling it with the provided geometries
Sourcepub fn from_nullable_geometry_collections(
geoms: &[Option<impl GeometryCollectionTrait<T = f64>>],
typ: GeometryCollectionType,
) -> GeoArrowResult<Self>
pub fn from_nullable_geometry_collections( geoms: &[Option<impl GeometryCollectionTrait<T = f64>>], typ: GeometryCollectionType, ) -> GeoArrowResult<Self>
Construct a new builder, pre-filling it with the provided geometries
Sourcepub fn from_nullable_geometries(
geoms: &[Option<impl GeometryTrait<T = f64>>],
typ: GeometryCollectionType,
) -> GeoArrowResult<Self>
pub fn from_nullable_geometries( geoms: &[Option<impl GeometryTrait<T = f64>>], typ: GeometryCollectionType, ) -> GeoArrowResult<Self>
Construct a new builder, pre-filling it with the provided geometries