1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use torin::alignment::Alignment;

use crate::Parse;

#[derive(Debug, PartialEq, Eq)]
pub struct ParseAlignmentError;

impl Parse for Alignment {
    type Err = ParseAlignmentError;

    fn parse(value: &str) -> Result<Self, Self::Err> {
        Ok(match value {
            "center" => Alignment::Center,
            "end" => Alignment::End,
            "space-between" => Alignment::SpaceBetween,
            "space-evenly" => Alignment::SpaceEvenly,
            "space-around" => Alignment::SpaceAround,
            _ => Alignment::Start,
        })
    }
}