diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
| commit | 76fc4cca62f5b955200b2c62cc85b69eea491ece (patch) | |
| tree | 5b8492268c996cf23b13e26c7a4356fbd156286d /src/geom/spec.rs | |
| parent | e8057a53856dc09594c9e5861f1cd328531616e0 (diff) | |
Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
Diffstat (limited to 'src/geom/spec.rs')
| -rw-r--r-- | src/geom/spec.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/geom/spec.rs b/src/geom/spec.rs index 510bac84..546eac7b 100644 --- a/src/geom/spec.rs +++ b/src/geom/spec.rs @@ -66,8 +66,8 @@ impl<T> Get<SpecAxis> for Spec<T> { impl<T> Switch for Spec<T> { type Other = Gen<T>; - fn switch(self, dirs: LayoutDirs) -> Self::Other { - match dirs.main.axis() { + fn switch(self, main: SpecAxis) -> Self::Other { + match main { SpecAxis::Horizontal => Gen::new(self.horizontal, self.vertical), SpecAxis::Vertical => Gen::new(self.vertical, self.horizontal), } @@ -102,13 +102,8 @@ impl SpecAxis { impl Switch for SpecAxis { type Other = GenAxis; - fn switch(self, dirs: LayoutDirs) -> Self::Other { - if self == dirs.main.axis() { - GenAxis::Main - } else { - debug_assert_eq!(self, dirs.cross.axis()); - GenAxis::Cross - } + fn switch(self, main: SpecAxis) -> Self::Other { + if self == main { GenAxis::Main } else { GenAxis::Cross } } } |
