Skip to main content

standout_types/
lib.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
2pub enum Representation {
3    #[default]
4    Human,
5    TermDebug,
6    Json,
7    Yaml,
8    Csv,
9    Ndjson,
10}
11
12impl Representation {
13    pub fn is_human(&self) -> bool {
14        matches!(self, Representation::Human | Representation::TermDebug)
15    }
16
17    pub fn is_debug(&self) -> bool {
18        matches!(self, Representation::TermDebug)
19    }
20
21    pub fn is_structured(&self) -> bool {
22        matches!(
23            self,
24            Representation::Json
25                | Representation::Yaml
26                | Representation::Csv
27                | Representation::Ndjson
28        )
29    }
30
31    pub fn is_stream(&self) -> bool {
32        matches!(self, Representation::Ndjson)
33    }
34}
35
36#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
37pub enum ColorPolicy {
38    #[default]
39    Auto,
40    Always,
41    Never,
42}