pub trait MultiPoint: Geometry<Kind = MultiPointTag> {
type ItemPoint: Point;
// Required method
fn points(&self) -> impl ExactSizeIterator<Item = &Self::ItemPoint>;
}Expand description
A multi-point — a collection of points belonging to each other.
Mirrors the MultiPoint concept (doc/concept/multi_point.qbk); the
canonical model is boost::geometry::model::multi_point in
boost/geometry/geometries/multi_point.hpp, which derives from
std::vector<Point> and asserts concepts::Point<Point> on its
element type. The Rust port mirrors that assertion by bounding
MultiPoint::ItemPoint on the Point concept.
As with crate::Linestring, the element sequence is exposed via
RPITIT so each impl can hand back whatever iterator its underlying
container provides. The ExactSizeIterator bound mirrors the
random-access shape boost::range relies on for the C++ model:
callers can ask for .len() without consuming the source.
§Examples
use geometry_trait::MultiPoint;
fn count<M: MultiPoint>(m: &M) -> usize { m.points().len() }Required Associated Types§
Sourcetype ItemPoint: Point
type ItemPoint: Point
The element point type.
Mirrors the Point template parameter on
boost::geometry::model::multi_point<Point, …>
(boost/geometry/geometries/multi_point.hpp). The Rust side
does not require ItemPoint == Self::Point: the C++ model
has no Self::Point projection of its own (its
point_type<MP>::type is read from the element), so any
Point is admissible here.
Required Methods§
Sourcefn points(&self) -> impl ExactSizeIterator<Item = &Self::ItemPoint>
fn points(&self) -> impl ExactSizeIterator<Item = &Self::ItemPoint>
The points of this multi-point, in declared order.
Plays the role of boost::begin(mp) / boost::end(mp) from
boost/geometry/geometries/multi_point.hpp when read together.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".