biji_ui/
lib.rs

1pub mod components;
2pub mod custom_animated_show;
3pub mod items;
4pub mod utils;
5
6pub trait Style {
7    fn style(&self) -> String;
8}
9
10impl Style for String {
11    fn style(&self) -> String {
12        self.to_string()
13    }
14}
15
16impl Style for Option<String> {
17    fn style(&self) -> String {
18        self.as_ref().map(|s| s.style()).unwrap_or_default()
19    }
20}
21
22impl Style for &str {
23    fn style(&self) -> String {
24        self.to_string()
25    }
26}
27
28#[macro_export]
29macro_rules! cn {
30    ($($styles: expr),*) => {
31        {
32            use $crate::Style;
33            let mut result = String::new();
34            $(
35                result.push_str(" ");
36                result.push_str(&$styles.style());
37            )*
38            result
39        }
40    };
41}