Skip to main content

peacock_crest/style/prop_validation/
image_rendering.rs

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