diff options
author | seancarroll <seanc28@gmail.com> | 2021-01-06 21:11:57 -0600 |
---|---|---|
committer | seancarroll <seanc28@gmail.com> | 2021-01-06 21:11:57 -0600 |
commit | c95ff86e2c8fbdd8e0cf6550aadc7ffc676dcc16 (patch) | |
tree | cfc0db9248e14f2ea675cf3b6dc67bf7243d1701 /src/attributes/page_direction.rs | |
parent | 0c8eb45449e578cae1f27e93df3f9cc92ba68219 (diff) | |
download | dotavious-c95ff86e2c8fbdd8e0cf6550aadc7ffc676dcc16.zip |
trying to organize files and use declarations
Diffstat (limited to 'src/attributes/page_direction.rs')
-rw-r--r-- | src/attributes/page_direction.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/attributes/page_direction.rs b/src/attributes/page_direction.rs new file mode 100644 index 0000000..df501ba --- /dev/null +++ b/src/attributes/page_direction.rs @@ -0,0 +1,33 @@ +use crate::dot::DotString; +use std::borrow::Cow; + +/// These specify the 8 row or column major orders for traversing a rectangular array, +/// the first character corresponding to the major order and the second to the minor order. +/// Thus, for “BL”, the major order is from bottom to top, and the minor order is from left to right. +/// This means the bottom row is traversed first, from left to right, then the next row up, +/// from left to right, and so on, until the topmost row is traversed +pub enum PageDirection { + BottomLeft, + BottomRight, + TopLeft, + TopRight, + RightBottom, + RightTop, + LeftBottom, + LeftTop, +} + +impl<'a> DotString<'a> for PageDirection { + fn dot_string(&self) -> Cow<'a, str> { + match self { + PageDirection::BottomLeft => "BL".into(), + PageDirection::BottomRight => "BR".into(), + PageDirection::TopLeft => "TL".into(), + PageDirection::TopRight => "TR".into(), + PageDirection::RightBottom => "RB".into(), + PageDirection::RightTop => "RT".into(), + PageDirection::LeftBottom => "LB".into(), + PageDirection::LeftTop => "LT".into(), + } + } +} |