-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathparsed_value.rs
More file actions
24 lines (23 loc) · 799 Bytes
/
parsed_value.rs
File metadata and controls
24 lines (23 loc) · 799 Bytes
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;
/// Return value of [`Formatter::parse_value`](super::Formatter::parse_value).
#[derive(Debug, Display, Clone, Copy)]
pub enum ParsedValue {
/// When input value is less than `scale_base`.
#[display("{value} ")]
Small {
/// Input value that is less than `scale_base`.
value: u16,
},
/// When input value is greater than `scale_base`.
#[display("{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,
},
}