rust_rectangle_dividing/
axis.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum Axis {
3    Vertical,
4    Horizontal,
5}
6
7impl Axis {
8    pub fn opposite(&self) -> Self {
9        match self {
10            Axis::Vertical => Axis::Horizontal,
11            Axis::Horizontal => Axis::Vertical,
12        }
13    }
14}
15
16pub trait ValueForAxis<T> {
17    fn value_for_axis(&self, axis: Axis) -> T;
18}
19
20pub trait SizeForAxis<T> {
21    fn size_for_axis(&self, axis: Axis) -> T;
22}