summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Saveau <saveau.alexandre@gmail.com>2023-05-11 05:56:17 -0700
committerGitHub <noreply@github.com>2023-05-11 14:56:17 +0200
commite472b0347f84f39edf4655d39f8b5484870d0a76 (patch)
treed722a59d87a2e438b06ed88eab2a313d2e4bfd13 /src
parent27771bc329ab23cc551637fb3feac7b5689e64c7 (diff)
Alternate between right/left alignment in equations (#936)
Diffstat (limited to 'src')
-rw-r--r--src/geom/align.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/geom/align.rs b/src/geom/align.rs
index 239a6e70..69f32bee 100644
--- a/src/geom/align.rs
+++ b/src/geom/align.rs
@@ -183,3 +183,22 @@ impl Fold for GenAlign {
self
}
}
+
+#[derive(Copy, Clone, Eq, PartialEq, Debug)]
+pub enum LeftRightAlternator {
+ Left,
+ Right,
+}
+
+impl Iterator for LeftRightAlternator {
+ type Item = LeftRightAlternator;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ let r = Some(*self);
+ match self {
+ Self::Left => *self = Self::Right,
+ Self::Right => *self = Self::Left,
+ }
+ r
+ }
+}