tailwind_css/modules/tables/table_layout/
mod.rs

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