diff options
Diffstat (limited to 'src/attributes/rankdir.rs')
-rw-r--r-- | src/attributes/rankdir.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/attributes/rankdir.rs b/src/attributes/rankdir.rs new file mode 100644 index 0000000..58fdeff --- /dev/null +++ b/src/attributes/rankdir.rs @@ -0,0 +1,22 @@ +use crate::dot::DotString; +use std::borrow::Cow; + +/// Corresponding to directed graphs drawn from top to bottom, from left to right, +/// from bottom to top, and from right to left, respectively. +pub enum RankDir { + TopBottom, + LeftRight, + BottomTop, + RightLeft, +} + +impl<'a> DotString<'a> for RankDir { + fn dot_string(&self) -> Cow<'a, str> { + match self { + RankDir::TopBottom => "TB".into(), + RankDir::LeftRight => "LR".into(), + RankDir::BottomTop => "BT".into(), + RankDir::RightLeft => "RL".into(), + } + } +} |