1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use super::Point;

#[derive(Debug, Clone, Copy)]
pub enum EndPoint<T> {
  Open(T),
  Closed(T),
}

impl<T> EndPoint<T> {
  pub fn inner(&self) -> &T {
    match self {
      EndPoint::Open(t) => &t,
      EndPoint::Closed(t) => &t,
    }
  }
}

#[derive(Debug, Clone, Copy)]
pub struct LineSegment<T, P, const N: usize>(
  pub EndPoint<(Point<T, N>, P)>,
  pub EndPoint<(Point<T, N>, P)>,
);

#[derive(Debug, Clone, Copy)]
pub struct LineSegmentView<'a, T, P, const N: usize>(
  pub EndPoint<(&'a Point<T, N>, &'a P)>,
  pub EndPoint<(&'a Point<T, N>, &'a P)>,
);