]> git.proxmox.com Git - rustc.git/blame - vendor/annotate-snippets/src/stylesheets/no_color.rs
New upstream version 1.46.0~beta.2+dfsg1
[rustc.git] / vendor / annotate-snippets / src / stylesheets / no_color.rs
CommitLineData
f035d41b
XL
1use std::fmt;
2
dc9dc135
XL
3use crate::formatter::style::{Style, StyleClass, Stylesheet};
4
5pub struct NoOpStyle {}
6
7impl 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 25pub struct NoColorStylesheet;
dc9dc135
XL
26
27impl Stylesheet for NoColorStylesheet {
416331ca 28 fn get_style(&self, _class: StyleClass) -> Box<dyn Style> {
dc9dc135
XL
29 Box::new(NoOpStyle {})
30 }
31}