summaryrefslogtreecommitdiff
path: root/src/attributes/label.rs
blob: e62de2b682e92d672eca02a3f9d2646e4ddb5ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::dot::DotString;
use std::borrow::Cow;

pub enum LabelJustification {
    Left,
    Right,
    Center,
}

impl<'a> DotString<'a> for LabelJustification {
    fn dot_string(&self) -> Cow<'a, str> {
        match self {
            LabelJustification::Left => "l".into(),
            LabelJustification::Right => "r".into(),
            LabelJustification::Center => "c".into(),
        }
    }
}

pub enum LabelLocation {
    Top,
    Center,
    Bottom,
}

impl<'a> DotString<'a> for LabelLocation {
    fn dot_string(&self) -> Cow<'a, str> {
        match self {
            LabelLocation::Top => "t".into(),
            LabelLocation::Center => "c".into(),
            LabelLocation::Bottom => "b".into(),
        }
    }
}