logo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use super::*;

mod traits;

#[derive(Copy, Clone, Debug)]
pub struct Negative(bool);

impl Negative {
    pub fn write(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self.0 {
            true => write!(f, "-"),
            false => write!(f, ""),
        }
    }
    pub fn get_properties(&self, value: &str) -> String {
        match self.0 {
            true => format!("-{}", value),
            false => value.to_string(),
        }
    }
    pub fn unwrap(&self) -> bool {
        self.0
    }
}