From c95ff86e2c8fbdd8e0cf6550aadc7ffc676dcc16 Mon Sep 17 00:00:00 2001 From: seancarroll Date: Wed, 6 Jan 2021 21:11:57 -0600 Subject: trying to organize files and use declarations --- src/attributes/rankdir.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/attributes/rankdir.rs (limited to 'src/attributes/rankdir.rs') 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(), + } + } +} -- cgit v1.2.3