[][src]Enum spinoso_time::ComponentOutOfRangeError

pub enum ComponentOutOfRangeError {
    Date,
    Time,
}

Error returned when constructing a Time from a ToA.

This error is returned when a time component in the ToA exeeds the maximum permissible value for a datetime. For example, invalid values include a datetime 5000 days or 301 seconds.

Examples

Invalid date component:

let to_a = ToA {
    sec: 21,
    min: 3,
    hour: 23,
    day: 5000,
    month: 4,
    year: 2020,
    wday: 0,
    yday: 96,
    isdst: true,
    zone: Offset::Local,
};
let time = Time::try_from(to_a);
assert_eq!(time, Err(ComponentOutOfRangeError::Date));

Invalid time component:

let to_a = ToA {
    sec: 301,
    min: 3,
    hour: 23,
    day: 5,
    month: 4,
    year: 2020,
    wday: 0,
    yday: 96,
    isdst: true,
    zone: Offset::Local,
};
let time = Time::try_from(to_a);
assert_eq!(time, Err(ComponentOutOfRangeError::Time));

Variants

Date

Date component (year, month, day) out of range.

Time

Time component (hour, minute, second) out of range.

Trait Implementations

impl Clone for ComponentOutOfRangeError[src]

impl Copy for ComponentOutOfRangeError[src]

impl Debug for ComponentOutOfRangeError[src]

impl Display for ComponentOutOfRangeError[src]

impl Eq for ComponentOutOfRangeError[src]

impl Error for ComponentOutOfRangeError[src]

impl Hash for ComponentOutOfRangeError[src]

impl Ord for ComponentOutOfRangeError[src]

impl PartialEq<ComponentOutOfRangeError> for ComponentOutOfRangeError[src]

impl PartialOrd<ComponentOutOfRangeError> for ComponentOutOfRangeError[src]

impl StructuralEq for ComponentOutOfRangeError[src]

impl StructuralPartialEq for ComponentOutOfRangeError[src]

Auto Trait Implementations

impl RefUnwindSafe for ComponentOutOfRangeError[src]

impl Send for ComponentOutOfRangeError[src]

impl Sync for ComponentOutOfRangeError[src]

impl Unpin for ComponentOutOfRangeError[src]

impl UnwindSafe for ComponentOutOfRangeError[src]

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.