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