torin/values/
direction.rs

1#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2#[derive(PartialEq, Eq, Clone, Debug, Default, Copy)]
3pub enum Direction {
4    /// Stack children vertically. This is the default.
5    #[default]
6    Vertical,
7    Horizontal,
8}
9
10impl Direction {
11    /// Use a [`Vertical`](Direction::Vertical) direction.
12    pub fn vertical() -> Direction {
13        Direction::Vertical
14    }
15
16    /// Use a [`Horizontal`](Direction::Horizontal) direction.
17    pub fn horizontal() -> Direction {
18        Direction::Horizontal
19    }
20
21    pub fn pretty(&self) -> String {
22        match self {
23            Self::Horizontal => "horizontal".to_string(),
24            Self::Vertical => "vertical".to_string(),
25        }
26    }
27}