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 derive_more::{Display, Error};

/// Return value of [`Formatter::parse_value`](super::Formatter::parse_value).
#[derive(Debug, Display, Clone, Copy, Error)]
pub enum ParsedValue {
    /// When input value is less than `scale_base`.
    #[display(fmt = "{value}   ")]
    Small {
        /// Input value that is less than `scale_base`.
        value: u16,
    },
    /// When input value is greater than `scale_base`.
    #[display(fmt = "{coefficient:.1}{unit}")]
    Big {
        /// The visible part of the number.
        coefficient: f32,
        /// The unit that follows `coefficient`.
        unit: char,
        /// The divisor that was used upon the original number to get `coefficient`.
        scale: u64,
        /// The exponent that was used upon base scale to get `scale`.
        exponent: usize,
    },
}