tailwind_css_fixes/modules/layouts/clear/
mod.rs

1use super::*;
2
3#[doc=include_str!("readme.md")]
4#[derive(Clone, Debug)]
5pub struct TailwindClear {
6    kind: StandardValue,
7}
8
9crate::macros::sealed::keyword_instance!(TailwindClear => "clear");
10
11impl Display for TailwindClear {
12    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
13        write!(f, "float-{}", self.kind)
14    }
15}
16
17impl TailwindClear {
18    /// <https://tailwindcss.com/docs/clear>
19    pub fn parse(pattern: &[&str], arbitrary: &TailwindArbitrary) -> Result<Self> {
20        let kind = StandardValue::parser("clear", &Self::check_valid)(pattern, arbitrary)?;
21        Ok(Self { kind })
22    }
23    /// <https://developer.mozilla.org/en-US/docs/Web/CSS/clear#syntax>
24    pub fn check_valid(mode: &str) -> bool {
25        let set = BTreeSet::from_iter(vec![
26            "both",
27            "inherit",
28            "initial",
29            "inline-end",
30            "inline-start",
31            "left",
32            "none",
33            "revert",
34            "right",
35            "unset",
36        ]);
37        set.contains(mode)
38    }
39}