peacock_crest/style/prop_validation/
position_vertical.rs1use super::{CssValue, TokenExpected};
2use crate::Unit;
3
4#[derive(Debug, Clone)]
5pub struct CssTop(Unit);
6
7#[derive(Debug, Clone)]
8pub struct CssBottom(Unit);
9
10#[derive(Debug, Clone, strum_macros::EnumString, strum_macros::Display)]
11pub enum KeywordPositionVertical {
12 #[strum(to_string = "auto", serialize = "auto")]
13 Auto,
14}
15
16impl From<Unit> for CssTop {
17 fn from(value: Unit) -> Self {
18 Self(value)
19 }
20}
21
22impl Into<Unit> for CssTop {
23 fn into(self) -> Unit {
24 self.0
25 }
26}
27
28impl From<Unit> for CssBottom {
29 fn from(value: Unit) -> Self {
30 Self(value)
31 }
32}
33
34impl Into<Unit> for CssBottom {
35 fn into(self) -> Unit {
36 self.0
37 }
38}
39
40impl CssValue for CssTop {
41 type Keyword = KeywordPositionVertical;
42
43 fn type_name() -> &'static str {
44 "CssTop"
45 }
46
47 fn type_token() -> TokenExpected {
48 TokenExpected::Dimension | TokenExpected::Percentage | TokenExpected::Ident
49 }
50}
51
52impl CssValue for CssBottom {
53 type Keyword = KeywordPositionVertical;
54
55 fn type_name() -> &'static str {
56 "CssBottom"
57 }
58
59 fn type_token() -> TokenExpected {
60 TokenExpected::Dimension | TokenExpected::Percentage | TokenExpected::Ident
61 }
62}