Skip to main content

Module convert

Module convert 

Source
Expand description

convert(src) -> Dst — typed conversions between equivalent geometry kinds.

Mirrors boost::geometry::convert(src, dst) from boost/geometry/algorithms/convert.hpp. Boost writes the destination through an out-parameter; the Rust port returns by value. A dedicated [Convert] trait (rather than core::convert::Into) keeps geometry conversions opt-in and sidesteps the orphan-rule clash a blanket From/Into would hit the moment a user adapts their own types.

Supported pairs:

  • BoxPolygon — the rectangle’s 5-point closed ring
  • RingPolygon — the ring becomes the exterior
  • RingLinestring — copy the point sequence
  • SegmentLinestring — two-point (start, end)
  • Point, Linestring, Polygon → single-member multi

LinestringRing is intentionally NOT shipped — the caller must assert closure and orientation for the destination, which Boost forces through template arguments anyway. Use Ring::from_vec(ls.0.clone()) (then correct) if you need it.

Functions§

convert
Convert src into the destination kind Dst.