TimeParseError variantv0.1.0

Source
Why text could not be read as a calendar value.
pub variant TimeParseError {
    InvalidSyntax(uint),
    InvalidMonth(uint),
    NonexistentDay(uint),
    InvalidTime(uint),
    ExcessiveFraction(uint),
    InvalidOffset(uint)
}

Failure-only: every case is a failure, and each carries the zero-based UTF-8 byte offset into the text where it was found. Success is Result::Success. Copy, carrying one offset.

Cases

NameDescription
InvalidSyntax(uint)The text does not have the shape required: a missing separator, a non-digit where a digit belongs, text after the value, or input that stops early. The offset is where the shape stopped matching, which is the text's length when it ran out.
InvalidMonth(uint)A well-formed two-digit month naming no month. The offset is the first of its digits.
NonexistentDay(uint)A well-formed day that the month does not have, such as the thirtieth of February. The offset is the first of its digits.
InvalidTime(uint)A well-formed hour, minute or second outside its range. The offset is the first digit of the offending field. Second 60 is not here: it is the leap second, and it folds rather than failing.
ExcessiveFraction(uint)More fraction digits than a nanosecond can hold. The offset is the first digit that could not be kept.
InvalidOffset(uint)A well-formed offset outside what an offset may be. The offset is the sign that opened it.

Implements ParseFailure

TimeParseError conforms to ParseFailure.

Offset

pub func Offset(self: &TimeParseError) -> uint

Where in the input the failure was found. Borrows the error. Cannot fail; runs in constant time and allocates nothing.

Returns: the zero-based UTF-8 byte offset, which is the text's length at end of input

Source