tailwind_css_fixes/modules/borders/divide/
mod.rs

1pub(crate) mod divide_color;
2pub(crate) mod divide_reverse;
3pub(crate) mod divide_style;
4pub(crate) mod divide_width;
5
6use super::*;
7
8#[derive(Copy, Clone, Debug, Default)]
9pub struct TailwindDivide {}
10
11impl TailwindDivide {
12    /// Parse the instructions starting with `divide`.
13    pub fn adapt(str: &[&str], arbitrary: &TailwindArbitrary) -> Result<Box<dyn TailwindInstance>> {
14        let out = match str {
15            // https://tailwindcss.com/docs/divide-width
16            ["x", "reverse"] => TailwindDivideReverse::from(true).boxed(),
17            ["y", "reverse"] => TailwindDivideReverse::from(false).boxed(),
18            ["x", rest @ ..] => TailwindDivideWidth::parse(rest, arbitrary, true)?.boxed(),
19            ["y", rest @ ..] => TailwindDivideWidth::parse(rest, arbitrary, false)?.boxed(),
20            // https://tailwindcss.com/docs/divide-style
21            [s @ ("solid" | "dashed" | "dotted" | "double" | "none")] => TailwindDivideStyle::from(*s).boxed(),
22            ["style", rest @ ..] => TailwindDivideStyle::parse(rest, arbitrary)?.boxed(),
23            // https://tailwindcss.com/docs/divide-color
24            _ => return syntax_error!("Unknown divide instructions: {}", str.join("-")),
25        };
26        Ok(out)
27    }
28}