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