Skip to main content

peacock_crest/style/prop_validation/
vertical_align.rs

1use super::{CssValue, TokenExpected};
2use crate::Unit;
3
4#[derive(Debug, Clone)]
5pub struct CssVerticalAlign(Unit);
6
7#[derive(Debug, Clone, strum_macros::EnumString, strum_macros::Display)]
8pub enum KeywordVerticalAlign {
9    #[strum(to_string = "top", serialize = "top")]
10    Top,
11
12    #[strum(to_string = "middle", serialize = "middle")]
13    Middle,
14
15    #[strum(to_string = "bottom", serialize = "bottom")]
16    Bottom,
17}
18
19impl From<Unit> for CssVerticalAlign {
20    fn from(value: Unit) -> Self {
21        Self(value)
22    }
23}
24
25impl Into<Unit> for CssVerticalAlign {
26    fn into(self) -> Unit {
27        self.0
28    }
29}
30
31impl CssValue for CssVerticalAlign {
32    type Keyword = KeywordVerticalAlign;
33
34    fn type_name() -> &'static str {
35        "CssVerticalAlign"
36    }
37
38    fn type_token() -> TokenExpected {
39        TokenExpected::Ident
40    }
41}