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
use super::*;
#[doc = include_str!("readme.md")]
#[derive(Copy, Clone, Debug)]
pub struct TailwindDelay {
ms: usize,
}
impl Display for TailwindDelay {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "delay-{}", self.ms)
}
}
impl TailwindInstance for TailwindDelay {
fn attributes(&self, _: &TailwindBuilder) -> BTreeSet<CssAttribute> {
css_attributes! {
"transition-delay" => format!("{}ms", self.ms)
}
}
}
impl TailwindDelay {
pub fn parse(input: &[&str], arbitrary: &TailwindArbitrary) -> Result<Self> {
debug_assert!(arbitrary.is_none(), "forbidden arbitrary after delay");
match input {
[n] => {
let a = TailwindArbitrary::from(*n);
Ok(Self { ms: a.as_integer()? })
},
_ => syntax_error!("Unknown delay instructions: {}", input.join("-")),
}
}
}