hexagon_map/point/
display.rs

1use super::*;
2use crate::AxialPoint;
3
4impl Debug for CubicPoint {
5    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
6        let h = self.p - self.q;
7        f.debug_struct("Cube").field("h", &h).field("p", &self.p).field("q", &self.q).finish()
8    }
9}
10
11impl Debug for AxialPoint {
12    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
13        let s = -self.q - self.r;
14        f.debug_struct("Axial").field("q", &self.q).field("r", &self.r).field("s", &s).finish()
15    }
16}
17
18impl Display for CubicPoint {
19    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
20        let h = self.p - self.q;
21        f.debug_tuple("Cube").field(&h).field(&self.p).field(&self.q).finish()
22    }
23}
24
25impl Display for AxialPoint {
26    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
27        let s = -self.q - self.r;
28        f.debug_tuple("Axial").field(&self.q).field(&self.r).field(&s).finish()
29    }
30}