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§
- A throughput in bits-per-second.
- A number of bytes.
- An amount of time. Should only use the time prefix types (
TimePrefix
andTimePrefixUpper
) with this type.
Enums§
- Common SI prefixes (including base-2 prefixes since they’re similar).
- Common SI prefixes larger than the base unit (including base-2 prefixes since they’re similar).
- 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 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.
Traits§
- The prefix of a unit value denoting magnitude. Common prefixes are SI prefixes (nano, micro, milli, etc).
- A unit containing a value (ex: an integer), a prefix (ex: an enum), and allowed constant suffix strings.