Skip to main content

geometry_trait/
closure.rs

1//! The [`Closure`] enum: whether a ring repeats its first point as
2//! its last.
3//!
4//! Mirrors `boost::geometry::closure_selector` from
5//! `boost/geometry/core/closure.hpp`. The Rust port drops the
6//! `closure_undetermined` variant — Boost itself marks it
7//! "(Not yet implemented)" in the same header and no algorithm in
8//! the C++ kernel relies on it. If a future task needs the
9//! undetermined variant it can be added without breaking the
10//! existing two-variant API by introducing a new wrapper type.
11
12/// Whether a ring repeats its first point as its last.
13///
14/// Mirrors `boost::geometry::closure_selector` from
15/// `boost/geometry/core/closure.hpp`.
16///
17/// # Examples
18///
19/// ```
20/// use geometry_trait::Closure;
21/// assert_ne!(Closure::Open, Closure::Closed);
22/// ```
23#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
24pub enum Closure {
25    /// Last point != first point — algorithms close the ring on the fly.
26    ///
27    /// Mirrors `boost::geometry::open` (value `0`) from
28    /// `boost/geometry/core/closure.hpp`.
29    Open,
30    /// Last point == first point — the ring carries the closing vertex
31    /// explicitly.
32    ///
33    /// Mirrors `boost::geometry::closed` (value `1`) from
34    /// `boost/geometry/core/closure.hpp`. This is the Boost default
35    /// (`traits::closure<G>::value = closed`), and the default returned
36    /// by [`crate::Ring::closure`].
37    Closed,
38}