wolf_graph_mermaid/details/
layout_direction.rs1use std::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4pub enum LayoutDirection {
5 TopToBottom,
6 LeftToRight,
7 BottomToTop,
8 RightToLeft,
9}
10
11impl LayoutDirection {
12 pub fn direction(&self) -> &'static str {
13 match self {
14 LayoutDirection::TopToBottom => "TB",
15 LayoutDirection::LeftToRight => "LR",
16 LayoutDirection::BottomToTop => "BT",
17 LayoutDirection::RightToLeft => "RL",
18 }
19 }
20}
21
22impl fmt::Display for LayoutDirection {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 write!(f, "{}", self.direction())
25 }
26}