dotavious/attributes/
page_direction.rs

1use crate::dot::DotString;
2use std::borrow::Cow;
3
4/// These specify the 8 row or column major orders for traversing a rectangular array,
5/// the first character corresponding to the major order and the second to the minor order.
6/// Thus, for “BL”, the major order is from bottom to top, and the minor order is from left to right.
7/// This means the bottom row is traversed first, from left to right, then the next row up,
8/// from left to right, and so on, until the topmost row is traversed
9pub enum PageDirection {
10    BottomLeft,
11    BottomRight,
12    TopLeft,
13    TopRight,
14    RightBottom,
15    RightTop,
16    LeftBottom,
17    LeftTop,
18}
19
20impl<'a> DotString<'a> for PageDirection {
21    fn dot_string(&self) -> Cow<'a, str> {
22        match self {
23            PageDirection::BottomLeft => "BL".into(),
24            PageDirection::BottomRight => "BR".into(),
25            PageDirection::TopLeft => "TL".into(),
26            PageDirection::TopRight => "TR".into(),
27            PageDirection::RightBottom => "RB".into(),
28            PageDirection::RightTop => "RT".into(),
29            PageDirection::LeftBottom => "LB".into(),
30            PageDirection::LeftTop => "LT".into(),
31        }
32    }
33}