geoarrow2::array::polygon

Struct MutablePolygonArray

Source
pub struct MutablePolygonArray<O: OffsetSizeTrait> { /* private fields */ }
Expand description

The Arrow equivalent to Vec<Option<Polygon>>. Converting a MutablePolygonArray into a PolygonArray is O(1).

Implementations§

Source§

impl<O: OffsetSizeTrait> MutablePolygonArray<O>

Source

pub fn new() -> Self

Creates a new empty MutablePolygonArray.

Source

pub fn with_capacities( coord_capacity: usize, ring_capacity: usize, geom_capacity: usize, ) -> Self

Creates a new MutablePolygonArray with given capacities and no validity.

Source

pub fn reserve( &mut self, coord_additional: usize, ring_additional: usize, geom_additional: usize, )

Reserves capacity for at least additional more LineStrings 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.

Source

pub fn reserve_exact( &mut self, coord_additional: usize, ring_additional: usize, geom_additional: usize, )

Reserves the minimum capacity for at least additional more LineStrings to be inserted in the given Vec<T>. 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 try_new( coords: MutableCoordBuffer, geom_offsets: OffsetsBuilder<O>, ring_offsets: OffsetsBuilder<O>, validity: NullBufferBuilder, ) -> Result<Self>

The canonical method to create a MutablePolygonArray out of its internal components.

§Implementation

This function is O(1).

§Errors
  • if the validity is not None and its length is different from the number of geometries
  • if the largest ring offset does not match the number of coordinates
  • if the largest geometry offset does not match the size of ring offsets
Source

pub fn into_inner( self, ) -> (MutableCoordBuffer, OffsetsBuilder<O>, OffsetsBuilder<O>, NullBufferBuilder)

Extract the low-level APIs from the MutablePolygonArray.

Source

pub fn into_array_ref(self) -> Arc<dyn Array>

Source

pub fn push_polygon( &mut self, value: Option<&impl PolygonTrait<T = f64>>, ) -> Result<()>

Add a new Polygon to the end of this array.

§Errors

This function errors iff the new last item is larger than what O supports.

Source

pub unsafe fn try_push_geom_offset( &mut self, offsets_length: usize, ) -> Result<()>

Push a raw offset to the underlying geometry offsets buffer.

§Safety

This is marked as unsafe because care must be taken to ensure that pushing raw offsets upholds the necessary invariants of the array.

Source

pub unsafe fn try_push_ring_offset( &mut self, offsets_length: usize, ) -> Result<()>

Push a raw offset to the underlying ring offsets buffer.

§Safety

This is marked as unsafe because care must be taken to ensure that pushing raw offsets upholds the necessary invariants of the array.

Source

pub unsafe fn push_xy(&mut self, x: f64, y: f64) -> Result<()>

Push a raw coordinate to the underlying coordinate array.

§Safety

This is marked as unsafe because care must be taken to ensure that pushing raw coordinates to the array upholds the necessary invariants of the array.

Trait Implementations§

Source§

impl<O: Debug + OffsetSizeTrait> Debug for MutablePolygonArray<O>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<O: OffsetSizeTrait> Default for MutablePolygonArray<O>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<O: OffsetSizeTrait> From<MutableMultiLineStringArray<O>> for MutablePolygonArray<O>

Polygon and MultiLineString have the same layout, so enable conversions between the two to change the semantic type

Source§

fn from(value: MutableMultiLineStringArray<O>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait> From<MutablePolygonArray<O>> for MutableMultiLineStringArray<O>

Polygon and MultiLineString have the same layout, so enable conversions between the two to change the semantic type

Source§

fn from(value: MutablePolygonArray<O>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait> From<MutablePolygonArray<O>> for PolygonArray<O>

Source§

fn from(other: MutablePolygonArray<O>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait, G: PolygonTrait<T = f64>> From<Vec<'_, G>> for MutablePolygonArray<O>

Source§

fn from(geoms: Vec<'_, G>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait, G: PolygonTrait<T = f64>> From<Vec<'_, Option<G>>> for MutablePolygonArray<O>

Source§

fn from(geoms: Vec<'_, Option<G>>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait, G: PolygonTrait<T = f64>> From<Vec<G>> for MutablePolygonArray<O>

Source§

fn from(geoms: Vec<G>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait, G: PolygonTrait<T = f64>> From<Vec<Option<G>>> for MutablePolygonArray<O>

Source§

fn from(geoms: Vec<Option<G>>) -> Self

Converts to this type from the input type.
Source§

impl<O: OffsetSizeTrait> IntoArrow for MutablePolygonArray<O>

Source§

impl<O: OffsetSizeTrait> TryFrom<WKBArray<O>> for MutablePolygonArray<O>

Source§

type Error = GeoArrowError

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

fn try_from(value: WKBArray<O>) -> Result<Self>

Performs the conversion.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool

Source§

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