rgeometry/
intersection.rs

1pub trait Intersects<T = Self> {
2  type Result;
3  fn intersect(self, other: T) -> Option<Self::Result>;
4}
5
6// // impl<T, U> Intersects<U> for T
7// // where
8// //   U: Intersects<T>,
9// // {
10// //   type Result = U::Result;
11// //   fn intersect(&self, other: &U) -> Self::Result {
12// //     other.intersect(self)
13// //   }
14// // }
15
16// struct Circle();
17
18// type Result<A, B> = <B as Intersects<A>>::Result;
19
20// pub enum CircleCircle {
21//   Touching,
22//   Overlapping,
23//   Identical,
24// }
25
26// impl Intersects<Circle> for Circle {
27//   type Result = CircleCircle;
28//   fn intersect(&self, _other: &Circle) -> Option<Self::Result> {
29//     todo!()
30//   }
31// }
32
33// fn test() {
34//   let x: Result<Circle, Circle> = CircleCircle::Touching;
35// }