pub struct SeparatedCoordBufferBuilder { /* private fields */ }
Expand description
The GeoArrow equivalent to Vec<Option<Coord>>
: a mutable collection of coordinates.
This stores all coordinates in separated fashion as multiple arrays: xxx
and yyy
.
Converting an SeparatedCoordBufferBuilder
into a SeparatedCoordBuffer
is O(1)
.
Implementations§
Source§impl SeparatedCoordBufferBuilder
impl SeparatedCoordBufferBuilder
Sourcepub fn with_capacity(capacity: usize, dim: Dimension) -> Self
pub fn with_capacity(capacity: usize, dim: Dimension) -> Self
Create a new builder with the given capacity and dimension
Sourcepub fn initialize(len: usize, dim: Dimension, value: f64) -> Self
pub fn initialize(len: usize, dim: Dimension, value: f64) -> Self
Initialize a buffer of a given length with all coordinates set to the given value
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more coordinates.
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 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 from_coords<'a>(
coords: impl ExactSizeIterator<Item = &'a (impl CoordTrait<T = f64> + 'a)>,
dim: Dimension,
) -> GeoArrowResult<Self>
pub fn from_coords<'a>( coords: impl ExactSizeIterator<Item = &'a (impl CoordTrait<T = f64> + 'a)>, dim: Dimension, ) -> GeoArrowResult<Self>
Construct a new builder and pre-fill it with coordinates from the provided iterator
Sourcepub fn finish(self) -> SeparatedCoordBuffer
pub fn finish(self) -> SeparatedCoordBuffer
Consume the builder and convert to an immutable SeparatedCoordBuffer
Trait Implementations§
Source§impl Clone for SeparatedCoordBufferBuilder
impl Clone for SeparatedCoordBufferBuilder
Source§fn clone(&self) -> SeparatedCoordBufferBuilder
fn clone(&self) -> SeparatedCoordBufferBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more