peacock_crest/style/prop_validation/
opacity.rs1use super::{CssValue, TokenExpected};
2use crate::Unit;
3
4#[derive(Debug, Clone)]
5pub struct CssOpacity(Unit);
6
7impl From<Unit> for CssOpacity {
8 fn from(value: Unit) -> Self {
9 Self(value)
10 }
11}
12
13impl Into<Unit> for CssOpacity {
14 fn into(self) -> Unit {
15 self.0
16 }
17}
18
19impl CssValue for CssOpacity {
20 type Keyword = super::KeywordNone;
21
22 fn type_name() -> &'static str {
23 "CssOpacity"
24 }
25
26 fn type_token() -> TokenExpected {
27 TokenExpected::Ident | TokenExpected::Number | TokenExpected::Percentage
28 }
29}