1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use super::*;
mod length;
use self::length::OutlineWidth;
#[doc = include_str!("readme.md")]
#[derive(Clone, Debug)]
pub struct TailwindOutlineWidth {
kind: OutlineWidth,
}
impl<T> From<T> for TailwindOutlineWidth
where
T: Into<String>,
{
fn from(kind: T) -> Self {
Self { kind: OutlineWidth::Standard(kind.into()) }
}
}
impl Display for TailwindOutlineWidth {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match &self.kind {
OutlineWidth::Unit(s) => write!(f, "outline-{}", s),
OutlineWidth::Standard(s) => write!(f, "outline-width-{}", s),
OutlineWidth::Length(s) => write!(f, "outline-width-{}", s),
}
}
}
impl TailwindInstance for TailwindOutlineWidth {
fn attributes(&self, _: &TailwindBuilder) -> BTreeSet<CssAttribute> {
let width = match &self.kind {
OutlineWidth::Unit(n) => format!("{}px", n),
OutlineWidth::Standard(n) => n.to_string(),
OutlineWidth::Length(n) => format!("{}", n),
};
css_attributes! {
"outline-width" => width
}
}
}
impl TailwindOutlineWidth {
pub fn parse(pattern: &[&str], arbitrary: &TailwindArbitrary) -> Result<Self> {
Ok(Self { kind: OutlineWidth::parse(pattern, arbitrary)? })
}
}