Expand description
Types for parsing/deserializing unit values.
let time = Time::from_str("10 min").unwrap();
assert_eq!(time, Time::new(10, TimePrefix::Min));
assert_eq!(
time.convert(TimePrefix::Sec).unwrap(),
Time::from_str("600 sec").unwrap()
);
Structs§
- Bits
PerSec - A throughput in bits-per-second.
- Bytes
- A number of bytes.
- Time
- An amount of time. Should only use the time prefix types (
TimePrefix
andTimePrefixUpper
) with this type.
Enums§
- SiPrefix
- Common SI prefixes (including base-2 prefixes since they’re similar).
- SiPrefix
Upper - Common SI prefixes larger than the base unit (including base-2 prefixes since they’re similar).
- Time
Prefix - Time units, which we pretend are prefixes for implementation simplicity. These
contain both the prefix (“n”, “u”, “m”) and the suffix (“sec”, “min”, “hr”)
and should be used with the
Time
unit. - Time
Prefix Upper - Time units larger than the base unit, which we pretend are prefixes for
implementation simplicity. These really contain the unit suffix (“sec”,
“min”, “hr”) and should be used with the
Time
unit.