[][src]Enum humantime::DurationError

pub enum DurationError {
    InvalidCharacter(usize),
    NumberExpected(usize),
    UnknownUnit {
        start: usize,
        end: usize,
        unit: String,
        value: u64,
    },
    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

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

Fields of UnknownUnit

start: usize

Start of the invalid unit inside the original string

end: usize

End of the invalid unit inside the original string

unit: String

The unit verbatim

value: u64

A number associated with the unit

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 Clone for Error[src]

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl PartialEq<Error> for Error[src]

impl StructuralPartialEq for Error[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.