pub enum Error {
InvalidCharacter(usize),
NumberExpected(usize),
UnknownUnit {
start: usize,
end: usize,
unit: String,
value: u64,
},
UnknownBinaryUnit {
start: usize,
end: usize,
unit: String,
value: u64,
},
NumberOverflow,
Empty,
}Expand description
Error parsing human-friendly bandwidth
Variants§
InvalidCharacter(usize)
Invalid character during parsing
More specifically anything that is not alphanumeric is prohibited
The field is an byte offset of the character in the string.
NumberExpected(usize)
Non-numeric value where number is expected
This usually means that either bandwidth unit is broken into words,
e.g. M bps instead of Mbps, or just number is omitted,
for example 2 Mbps kbps instead of 2 Mbps 1 kbps
The field is an byte offset of the erroneous character in the string.
UnknownUnit
Unit in the number is not one of allowed units
See documentation of parse_bandwidth for the list of supported
bandwidth units.
The two fields are start and end (exclusive) of the slice from the original string, containing erroneous value
Fields
UnknownBinaryUnit
Unit in the number is not one of allowed units (in the binary prefix system)
See documentation of parse_binary_bandwidth for the list of supported
bandwidth units.
The two fields are start and end (exclusive) of the slice from the original string, containing erroneous value
Fields
NumberOverflow
The numeric value is too large
Usually this means value is too large to be useful.
Empty
The value was an empty string (or consists only whitespace)