papergrid/colors/
nocolors.rs

1use core::fmt;
2
3use crate::colors::{ANSIFmt, Colors};
4use crate::config::Position;
5
6/// The structure represents empty [`Colors`] map.
7#[derive(Debug, Clone, Copy, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
8pub struct NoColors;
9
10impl Colors for NoColors {
11    type Color = NoColor;
12
13    fn get_color(&self, _: Position) -> Option<&Self::Color> {
14        None
15    }
16
17    fn is_empty(&self) -> bool {
18        true
19    }
20}
21
22/// A color which is actually has not value.
23#[derive(Debug, Clone, Copy, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
24pub struct NoColor;
25
26impl ANSIFmt for NoColor {
27    fn fmt_ansi_prefix<W: fmt::Write>(&self, _: &mut W) -> fmt::Result {
28        Ok(())
29    }
30
31    fn fmt_ansi_suffix<W: fmt::Write>(&self, _: &mut W) -> fmt::Result {
32        Ok(())
33    }
34}