diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-06-06 21:13:59 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-06-06 22:06:16 +0200 |
| commit | fd417da04f7ca4b995de7f6510abafd3e9c31307 (patch) | |
| tree | 3675529c75ca7363701ac8ea306de2cc1d3cbcb3 /library/src/math/row.rs | |
| parent | 168bdf35bd773e67343c965cb473492cc5cae9e7 (diff) | |
Improve value casting infrastructure
Diffstat (limited to 'library/src/math/row.rs')
| -rw-r--r-- | library/src/math/row.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/src/math/row.rs b/library/src/math/row.rs index 9b693bc1..6e666e89 100644 --- a/library/src/math/row.rs +++ b/library/src/math/row.rs @@ -233,3 +233,22 @@ impl<T: Into<MathFragment>> From<T> for MathRow { Self(vec![fragment.into()]) } } + +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +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 + } +} |
