tailwind_css/traits/
mod.rs

1use std::{
2    cmp::Ordering,
3    fmt::{Debug, Display, Formatter},
4    hash::{Hash, Hasher},
5};
6
7use crate::{CssAttributes, TailwindBuilder};
8
9pub mod instance;
10
11#[allow(unused_variables)]
12pub trait TailwindInstance: Display {
13    /// used to deduplication and marking
14    #[inline]
15    fn id(&self) -> String {
16        self.to_string()
17    }
18    /// used to deduplication and marking
19    fn inlineable(&self) -> bool {
20        true
21    }
22    /// New tailwind instance
23    fn boxed(self) -> Box<dyn TailwindInstance>
24    where
25        Self: Sized,
26        Self: 'static,
27    {
28        Box::new(self)
29    }
30    /// Custom selector name
31    fn selectors(&self, ctx: &TailwindBuilder) -> String {
32        format!(".{}", self.id())
33    }
34    /// Attributes in css
35    fn attributes(&self, ctx: &TailwindBuilder) -> CssAttributes;
36    /// Additional css in bundle
37    fn additional(&self, ctx: &TailwindBuilder) -> String {
38        String::new()
39    }
40}