50 } |
50 } |
51 } |
51 } |
52 } |
52 } |
53 } |
53 } |
54 |
54 |
|
55 impl std::fmt::Display for Face { |
|
56 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
|
57 let s = match *self { |
|
58 F1 => "F1", |
|
59 F2 => "F2", |
|
60 F3 => "F3", |
|
61 F4 => "F4", |
|
62 F5 => "F5", |
|
63 F6 => "F6", |
|
64 }; |
|
65 write!(f, "{}", s) |
|
66 } |
|
67 } |
55 |
68 |
56 impl Face { |
69 impl Face { |
|
70 /// Return an aray of all faces |
|
71 pub fn all() -> [Face; 6] { |
|
72 [F1, F2, F3, F4, F5, F6] |
|
73 } |
|
74 |
57 /// Returns an array of the four faces adjacent to `self` in the |
75 /// Returns an array of the four faces adjacent to `self` in the |
58 /// order [left, right, down, up] in the `self`-relative unfolding. |
76 /// order [left, right, down, up] in the `self`-relative unfolding. |
59 pub fn adjacent_faces(&self) -> AdjacentFaces { |
77 pub fn adjacent_faces(&self) -> AdjacentFaces { |
60 match *self { |
78 match *self { |
61 F1 => [F3, F2, F4, F5], |
79 F1 => [F3, F2, F4, F5], |