pub struct RectBuilder { /* private fields */ }
Expand description
The GeoArrow equivalent to Vec<Option<Rect>>
: a mutable collection of Rects.
Converting an RectBuilder
into a RectArray
is O(1)
.
Implementations§
Source§impl RectBuilder
impl RectBuilder
Sourcepub fn new(typ: BoxType) -> Self
pub fn new(typ: BoxType) -> Self
Creates a new empty RectBuilder
.
Sourcepub fn with_capacity(typ: BoxType, capacity: usize) -> Self
pub fn with_capacity(typ: BoxType, capacity: usize) -> Self
Creates a new RectBuilder
with a capacity.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more Rects.
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 Rects.
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 try_new(
lower: SeparatedCoordBufferBuilder,
upper: SeparatedCoordBufferBuilder,
validity: NullBufferBuilder,
data_type: BoxType,
) -> GeoArrowResult<Self>
pub fn try_new( lower: SeparatedCoordBufferBuilder, upper: SeparatedCoordBufferBuilder, validity: NullBufferBuilder, data_type: BoxType, ) -> GeoArrowResult<Self>
The canonical method to create a RectBuilder
out of its internal components.
§Implementation
This function is O(1)
.
§Errors
This function errors iff:
- The validity is not
None
and its length is different from the number of geometries
Sourcepub fn push_rect(&mut self, value: Option<&impl RectTrait<T = f64>>)
pub fn push_rect(&mut self, value: Option<&impl RectTrait<T = f64>>)
Add a new Rect to the end of this builder.
Sourcepub fn push_min_max(
&mut self,
min: &impl CoordTrait<T = f64>,
max: &impl CoordTrait<T = f64>,
)
pub fn push_min_max( &mut self, min: &impl CoordTrait<T = f64>, max: &impl CoordTrait<T = f64>, )
Push min and max coordinates of a rect to the builder.
Sourcepub fn from_rects<'a>(
geoms: impl ExactSizeIterator<Item = &'a (impl RectTrait<T = f64> + 'a)>,
typ: BoxType,
) -> Self
pub fn from_rects<'a>( geoms: impl ExactSizeIterator<Item = &'a (impl RectTrait<T = f64> + 'a)>, typ: BoxType, ) -> Self
Create this builder from a iterator of Rects.
Sourcepub fn from_nullable_rects<'a>(
geoms: impl ExactSizeIterator<Item = Option<&'a (impl RectTrait<T = f64> + 'a)>>,
typ: BoxType,
) -> Self
pub fn from_nullable_rects<'a>( geoms: impl ExactSizeIterator<Item = Option<&'a (impl RectTrait<T = f64> + 'a)>>, typ: BoxType, ) -> Self
Create this builder from a iterator of nullable Rects.