]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
1 | use std::fmt; |
2 | ||
dc9dc135 XL |
3 | use crate::formatter::style::{Style, StyleClass, Stylesheet}; |
4 | ||
5 | pub struct NoOpStyle {} | |
6 | ||
7 | impl Style for NoOpStyle { | |
f035d41b XL |
8 | fn paint(&self, text: &str, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
9 | f.write_str(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) | |
dc9dc135 XL |
18 | } |
19 | ||
416331ca | 20 | fn bold(&self) -> Box<dyn Style> { |
dc9dc135 XL |
21 | Box::new(NoOpStyle {}) |
22 | } | |
23 | } | |
24 | ||
f035d41b | 25 | pub struct NoColorStylesheet; |
dc9dc135 XL |
26 | |
27 | impl Stylesheet for NoColorStylesheet { | |
416331ca | 28 | fn get_style(&self, _class: StyleClass) -> Box<dyn Style> { |
dc9dc135 XL |
29 | Box::new(NoOpStyle {}) |
30 | } | |
31 | } |