1use std::fmt::{Display, Formatter, Result};
2pub use style::Style;
3
4mod style;
5
6pub struct CSS {
8 styles: Vec<Style>,
9}
10
11impl CSS {
12 pub fn new() -> Self {
14 CSS { styles: vec![] }
15 }
16
17 pub fn add_style(&mut self, style: Style) {
19 self.styles.push(style);
20 }
21}
22
23impl Display for CSS {
24 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
25 write!(
26 f,
27 "{}",
28 self.styles
29 .iter()
30 .map(|x| format!("{}", x))
31 .collect::<Vec<String>>()
32 .join("\n\n")
33 )
34 }
35}