pub enum CoordBufferBuilder {
Interleaved(InterleavedCoordBufferBuilder),
Separated(SeparatedCoordBufferBuilder),
}
Expand description
The GeoArrow equivalent to Vec<Coord>
: a mutable collection of coordinates.
Converting an CoordBufferBuilder
into a CoordBuffer
is O(1)
.
Variants§
Interleaved(InterleavedCoordBufferBuilder)
Interleaved coordinates
Separated(SeparatedCoordBufferBuilder)
Separated coordinates
Implementations§
Source§impl CoordBufferBuilder
impl CoordBufferBuilder
Sourcepub fn initialize(
len: usize,
coord_type: CoordType,
dim: Dimension,
value: f64,
) -> Self
pub fn initialize( len: usize, coord_type: CoordType, dim: Dimension, value: f64, ) -> Self
Initialize a buffer of a given length with all coordinates set to the given value.
Sourcepub fn with_capacity(len: usize, coord_type: CoordType, dim: Dimension) -> Self
pub fn with_capacity(len: usize, coord_type: CoordType, dim: Dimension) -> Self
Create a new builder with the given capacity and dimension
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more coordinates 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 coordinates.
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 capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the total number of coordinates the vector can hold without reallocating.
Sourcepub fn coord_type(&self) -> CoordType
pub fn coord_type(&self) -> CoordType
The underlying coordinate type
Sourcepub fn push_coord(&mut self, coord: &impl CoordTrait<T = f64>)
pub fn push_coord(&mut self, coord: &impl CoordTrait<T = f64>)
Push a new coord onto the end of this coordinate buffer
§Panics
- If the added coordinate does not have the same dimension as the coordinate buffer.
Sourcepub fn try_push_coord(
&mut self,
coord: &impl CoordTrait<T = f64>,
) -> GeoArrowResult<()>
pub fn try_push_coord( &mut self, coord: &impl CoordTrait<T = f64>, ) -> GeoArrowResult<()>
Push a new coord onto the end of this coordinate buffer
§Errors
- If the added coordinate does not have the same dimension as the coordinate buffer.
Sourcepub fn push_point(&mut self, point: &impl PointTrait<T = f64>)
pub fn push_point(&mut self, point: &impl PointTrait<T = f64>)
Push a new point onto the end of this coordinate buffer
§Panics
- If the added point does not have the same dimension as the coordinate buffer.
Sourcepub fn try_push_point(
&mut self,
point: &impl PointTrait<T = f64>,
) -> GeoArrowResult<()>
pub fn try_push_point( &mut self, point: &impl PointTrait<T = f64>, ) -> GeoArrowResult<()>
Push a new point onto the end of this coordinate buffer
§Errors
- If the added point does not have the same dimension as the coordinate buffer.
Sourcepub fn finish(self) -> CoordBuffer
pub fn finish(self) -> CoordBuffer
Consume the builder and convert to an immutable CoordBuffer
Trait Implementations§
Source§impl Clone for CoordBufferBuilder
impl Clone for CoordBufferBuilder
Source§fn clone(&self) -> CoordBufferBuilder
fn clone(&self) -> CoordBufferBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more