| 1 | use std::fmt; |
| 2 | |
| 3 | use crate::formatter::style::{Style, StyleClass, Stylesheet}; |
| 4 | |
| 5 | pub struct NoOpStyle {} |
| 6 | |
| 7 | impl Style for NoOpStyle { |
| 8 | fn paint(&self, text: &str, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 9 | f.write_str(data:text) |
| 10 | } |
| 11 | |
| 12 | fn paint_fn<'a>( |
| 13 | &self, |
| 14 | c: Box<dyn FnOnce(&mut fmt::Formatter<'_>) -> fmt::Result + 'a>, |
| 15 | f: &mut fmt::Formatter<'_>, |
| 16 | ) -> fmt::Result { |
| 17 | c(f) |
| 18 | } |
| 19 | |
| 20 | fn bold(&self) -> Box<dyn Style> { |
| 21 | Box::new(NoOpStyle {}) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | pub struct NoColorStylesheet; |
| 26 | |
| 27 | impl Stylesheet for NoColorStylesheet { |
| 28 | fn get_style(&self, _class: StyleClass) -> Box<dyn Style> { |
| 29 | Box::new(NoOpStyle {}) |
| 30 | } |
| 31 | } |
| 32 | |