Trait LineStringTrait

Source
pub trait LineStringTrait: Sized + GeometryTrait {
    type CoordType<'a>: 'a + CoordTrait<T = Self::T>
       where Self: 'a;

    // Required methods
    fn num_coords(&self) -> usize;
    unsafe fn coord_unchecked(&self, i: usize) -> Self::CoordType<'_>;

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

A trait for accessing data from a generic LineString.

A LineString is an ordered collection of two or more points, representing a path between locations.

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

Required Associated Types§

Source

type CoordType<'a>: 'a + CoordTrait<T = Self::T> where Self: 'a

The type of each underlying coordinate, which implements CoordTrait

Required Methods§

Source

fn num_coords(&self) -> usize

The number of coordinates in this LineString

Source

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

Access to a specified coordinate in this LineString

§Safety

Accessing an index out of bounds is UB.

Provided Methods§

Source

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

An iterator over the coordinates in this LineString

Source

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

Access to a specified coordinate in this LineString 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<T: CoordNum> LineStringTrait for &LineString<T>

Source§

type CoordType<'b> = Coord<<&LineString<T> as GeometryTrait>::T> where Self: 'b

Source§

fn num_coords(&self) -> usize

Source§

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

Source§

impl<T: CoordNum> LineStringTrait for LineString<T>

Source§

type CoordType<'a> = Coord<<LineString<T> as GeometryTrait>::T> where Self: 'a

Source§

fn num_coords(&self) -> usize

Source§

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

Implementors§