Skip to main content

leptos_css/
global_keyword.rs

1use std::fmt;
2
3use crate::checked_value::impl_checked_value;
4use crate::serialization::CssWriteTo;
5
6/// CSS-wide keywords accepted by ordinary CSS properties.
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
8#[non_exhaustive]
9pub enum GlobalKeyword {
10    /// The `inherit` keyword.
11    Inherit,
12    /// The `initial` keyword.
13    Initial,
14    /// The `unset` keyword.
15    Unset,
16    /// The `revert` keyword.
17    Revert,
18    /// The `revert-layer` keyword.
19    RevertLayer,
20}
21
22impl CssWriteTo for GlobalKeyword {
23    fn css_fmt<W: fmt::Write>(&self, w: &mut W) -> fmt::Result {
24        w.write_str(match self {
25            Self::Inherit => "inherit",
26            Self::Initial => "initial",
27            Self::Unset => "unset",
28            Self::Revert => "revert",
29            Self::RevertLayer => "revert-layer",
30        })
31    }
32}
33
34impl_checked_value!(GlobalKeyword);