Struct SeparatedCoordBufferBuilder

Source
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

Source

pub fn new(dim: Dimension) -> Self

Create a new empty builder with the given dimension

Source

pub fn with_capacity(capacity: usize, dim: Dimension) -> Self

Create a new builder with the given capacity and dimension

Source

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

Source

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.

Source

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.

Source

pub fn capacity(&self) -> usize

Returns the total number of coordinates the vector can hold without reallocating.

Source

pub fn len(&self) -> usize

The number of coordinates in this builder

Source

pub fn is_empty(&self) -> bool

Whether this builder is empty

Source

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.
Source

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.
Source

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

Source

pub fn finish(self) -> SeparatedCoordBuffer

Consume the builder and convert to an immutable SeparatedCoordBuffer

Trait Implementations§

Source§

impl Clone for SeparatedCoordBufferBuilder

Source§

fn clone(&self) -> SeparatedCoordBufferBuilder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SeparatedCoordBufferBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,