Skip to main content

peacock_crest/style/prop_validation/
line_height.rs

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