Enum humantime::DurationError []

pub enum DurationError {
    InvalidCharacter(usize),
    NumberExpected(usize),
    UnknownUnit(usizeusize),
    NumberOverflow,
    Empty,
}

Error parsing human-friendly duration

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 time unit is broken into words, e.g. m sec instead of msec, or just number is omitted, for example 2 hours min instead of 2 hours 1 min

The field is an byte offset of the errorneous character in the string.

UnknownUnit(usizeusize)

Unit in the number is not one of allowed units

See documentation of parse_duration for the list of supported time units.

The two fields are start and end (exclusive) of the slice from the original string, containing errorneous value

NumberOverflow

The numeric value is too large

Usually this means value is too large to be useful. If user writes data in subsecond units, then the maximum is about 3k years. When using seconds, or larger units, the limit is even larger.

Empty

The value was an empty string (or consists only whitespace)

Trait Implementations

impl Copy for Error
[src]

impl Clone for Error
[src]

fn clone(&self) -> Error

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl PartialEq for Error
[src]

fn eq(&self, __arg_0: &Error) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Error) -> bool

This method tests for !=.

impl Debug for Error
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Display for Error

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Error for Error

fn description(&self) -> &str

A short description of the error. Read more

fn cause(&self) -> Option<&Error>

The lower-level cause of this error, if any. Read more