Trait MultiPolygonTrait

Source
pub trait MultiPolygonTrait: Sized + GeometryTrait {
    type InnerPolygonType<'a>: 'a + PolygonTrait<T = Self::T>
       where Self: 'a;

    // Required methods
    fn num_polygons(&self) -> usize;
    unsafe fn polygon_unchecked(&self, i: usize) -> Self::InnerPolygonType<'_>;

    // Provided methods
    fn polygons(
        &self,
    ) -> impl DoubleEndedIterator + ExactSizeIterator<Item = Self::InnerPolygonType<'_>> { ... }
    fn polygon(&self, i: usize) -> Option<Self::InnerPolygonType<'_>> { ... }
}
Expand description

A trait for accessing data from a generic MultiPolygon.

Refer to geo_types::MultiPolygon for information about semantics and validity.

Required Associated Types§

Source

type InnerPolygonType<'a>: 'a + PolygonTrait<T = Self::T> where Self: 'a

The type of each underlying Polygon, which implements PolygonTrait

Required Methods§

Source

fn num_polygons(&self) -> usize

The number of polygons in this MultiPolygon

Source

unsafe fn polygon_unchecked(&self, i: usize) -> Self::InnerPolygonType<'_>

Access to a specified polygon in this MultiPolygon

§Safety

Accessing an index out of bounds is UB.

Provided Methods§

Source

fn polygons( &self, ) -> impl DoubleEndedIterator + ExactSizeIterator<Item = Self::InnerPolygonType<'_>>

An iterator over the Polygons in this MultiPolygon

Source

fn polygon(&self, i: usize) -> Option<Self::InnerPolygonType<'_>>

Access to a specified polygon in this MultiPolygon Will return None if the provided index is out of bounds

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: CoordNum> MultiPolygonTrait for &'a MultiPolygon<T>

Source§

type InnerPolygonType<'b> = &'a Polygon<<&'a MultiPolygon<T> as GeometryTrait>::T> where Self: 'b

Source§

fn num_polygons(&self) -> usize

Source§

unsafe fn polygon_unchecked(&self, i: usize) -> Self::InnerPolygonType<'_>

Source§

impl<T: CoordNum> MultiPolygonTrait for MultiPolygon<T>

Source§

type InnerPolygonType<'a> = &'a Polygon<<MultiPolygon<T> as GeometryTrait>::T> where Self: 'a

Source§

fn num_polygons(&self) -> usize

Source§

unsafe fn polygon_unchecked(&self, i: usize) -> Self::InnerPolygonType<'_>

Implementors§