summaryrefslogtreecommitdiff
path: root/src/attributes/rankdir.rs
blob: 58fdeffd5f8b965ef7d9491f8f6f9b41e1d6d33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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(),
        }
    }
}