Trait GeometryCollectionTrait

Source
pub trait GeometryCollectionTrait: Sized + GeometryTrait {
    type GeometryType<'a>: 'a + GeometryTrait<T = Self::T>
       where Self: 'a;

    // Required methods
    fn num_geometries(&self) -> usize;
    unsafe fn geometry_unchecked(&self, i: usize) -> Self::GeometryType<'_>;

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

A trait for accessing data from a generic GeometryCollection.

A GeometryCollection is a collection of Geometry types.

Required Associated Types§

Source

type GeometryType<'a>: 'a + GeometryTrait<T = Self::T> where Self: 'a

The type of each underlying geometry, which implements GeometryTrait

Required Methods§

Source

fn num_geometries(&self) -> usize

The number of geometries in this GeometryCollection

Source

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

Access to a specified geometry in this GeometryCollection

§Safety

Accessing an index out of bounds is UB.

Provided Methods§

Source

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

An iterator over the geometries in this GeometryCollection

Source

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

Access to a specified geometry in this GeometryCollection 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> GeometryCollectionTrait for &'a GeometryCollection<T>

Source§

type GeometryType<'b> = &'a Geometry<<&'a GeometryCollection<T> as GeometryTrait>::T> where Self: 'b

Source§

fn num_geometries(&self) -> usize

Source§

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

Source§

impl<T: CoordNum> GeometryCollectionTrait for GeometryCollection<T>

Source§

type GeometryType<'a> = &'a Geometry<<GeometryCollection<T> as GeometryTrait>::T> where Self: 'a

Source§

fn num_geometries(&self) -> usize

Source§

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

Implementors§