Enum twilight_model::datetime::error::RangeField[][src]

pub enum RangeField {
    Day {
        year: u16,
        month: u8,
        value: u8,
    },
    Hour {
        value: u8,
    },
    Minute {
        value: u8,
    },
    Month {
        value: u8,
    },
    Second {
        value: u8,
    },
    Year {
        value: u16,
    },
}
Expand description

Field that is out of range.

During parsing of timestamps the values of fields - such as the hour or day portion of a timestamp - are validated. If one is outside of the accepted range then the function is short-circuited an an error is returned.

Variants

Day

Day field is out of the acceptable range.

The acceptable ranges are:

  • [1, 31] in the case of January, March, May, July, August, October, and December;
  • [1, 30] in the case of April, June, September, and November;
  • [1, 29] in the case of February on a leap year;
  • [1, 28] in the case of February on a year that is not a leap year.

Fields of Day

year: u16

Year.

Can be used in combination with month to determine the range of acceptable days.

month: u8

Month of the year.

Can be used in combination with year to determine the range of acceptable days.

value: u8

Provided value.

Hour

Hour field is out of the acceptable range.

The acceptable range is [0, 23].

Fields of Hour

value: u8

Provided value.

Minute

Minute field is out of the acceptable range.

The acceptable range is [0, 59].

Fields of Minute

value: u8

Provided value.

Month

Month field is out of the acceptable range.

The acceptable range is [1, 12].

Fields of Month

value: u8

Provided value.

Second

Second field is out of the acceptable range.

The acceptable range is [0, 59], or [0, 60] in the case of a leap second.

Fields of Second

value: u8

Provided value.

Year

Year field is out of the acceptable range.

The acceptable range is [2010, 2038].

Fields of Year

value: u16

Provided value.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more