1 use crate::common::*;
2 
3 pub(crate) trait ColorDisplay {
color_display<'a>(&'a self, color: Color) -> Wrapper<'a> where Self: Sized,4   fn color_display<'a>(&'a self, color: Color) -> Wrapper<'a>
5   where
6     Self: Sized,
7   {
8     Wrapper(self, color)
9   }
10 
fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result11   fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result;
12 }
13 
14 pub(crate) struct Wrapper<'a>(&'a dyn ColorDisplay, Color);
15 
16 impl<'a> Display for Wrapper<'a> {
fmt(&self, f: &mut Formatter) -> fmt::Result17   fn fmt(&self, f: &mut Formatter) -> fmt::Result {
18     self.0.fmt(f, self.1)
19   }
20 }
21