Skip to main content

MultiLinestring

Trait MultiLinestring 

Source
pub trait MultiLinestring: Geometry<Kind = MultiLinestringTag> {
    type ItemLinestring: Linestring<Point = Self::Point>;

    // Required method
    fn linestrings(
        &self,
    ) -> impl ExactSizeIterator<Item = &Self::ItemLinestring>;
}
Expand description

A multi-linestring — a collection of linestrings belonging to each other (e.g. a highway with interruptions).

Mirrors the MultiLinestring concept (doc/concept/multi_linestring.qbk); the canonical model is boost::geometry::model::multi_linestring in boost/geometry/geometries/multi_linestring.hpp, which derives from std::vector<LineString> and asserts concepts::Linestring<LineString> on its element type. The Rust port mirrors that assertion by bounding MultiLinestring::ItemLinestring on the Linestring concept, and additionally pins ItemLinestring::Point = Self::Point so the multi’s point_type<MLS> projection (read through any element) stays consistent across the collection.

§Examples

use geometry_trait::MultiLinestring;
fn count<M: MultiLinestring>(m: &M) -> usize { m.linestrings().len() }

Required Associated Types§

Source

type ItemLinestring: Linestring<Point = Self::Point>

The element linestring type.

Mirrors the LineString template parameter on boost::geometry::model::multi_linestring<LineString, …> (boost/geometry/geometries/multi_linestring.hpp).

Required Methods§

Source

fn linestrings(&self) -> impl ExactSizeIterator<Item = &Self::ItemLinestring>

The linestrings of this multi-linestring, in declared order.

Plays the role of boost::begin(mls) / boost::end(mls) from boost/geometry/geometries/multi_linestring.hpp when read together.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§