summaryrefslogtreecommitdiff
path: root/src/attributes/ratio.rs
blob: a8fbad86fcdb9dbf0d72843b7a8ece530be4b95e (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;

pub enum Ratio {
    Aspect(f32),
    Fill,
    Compress,
    Expand,
    Auto,
}

impl<'a> DotString<'a> for Ratio {
    fn dot_string(&self) -> Cow<'a, str> {
        match self {
            Ratio::Aspect(aspect) => aspect.to_string().into(),
            Ratio::Fill => "fill".into(),
            Ratio::Compress => "compress".into(),
            Ratio::Expand => "expand".into(),
            Ratio::Auto => "auto".into(),
        }
    }
}