pub enum LocalResult<T> {
    None,
    Single(T),
    Ambiguous(T, T),
}
Expand description

The conversion result from the local time to the timezone-aware datetime types.

Variants§

§

None

Given local time representation is invalid. This can occur when, for example, the positive timezone transition.

§

Single(T)

Given local time representation has a single unique result.

§

Ambiguous(T, T)

Given local time representation has multiple results and thus ambiguous. This can occur when, for example, the negative timezone transition.

Implementations§

Returns Some only when the conversion result is unique, or None otherwise.

Returns Some for the earliest possible conversion result, or None if none.

Returns Some for the latest possible conversion result, or None if none.

Maps a LocalResult<T> into LocalResult<U> with given function.

Makes a new DateTime from the current date and given NaiveTime. The offset in the current date is preserved.

Propagates any error. Ambiguous result would be discarded.

Makes a new DateTime from the current date, hour, minute and second. The offset in the current date is preserved.

Propagates any error. Ambiguous result would be discarded.

Makes a new DateTime from the current date, hour, minute, second and millisecond. The millisecond part can exceed 1,000 in order to represent the leap second. The offset in the current date is preserved.

Propagates any error. Ambiguous result would be discarded.

Makes a new DateTime from the current date, hour, minute, second and microsecond. The microsecond part can exceed 1,000,000 in order to represent the leap second. The offset in the current date is preserved.

Propagates any error. Ambiguous result would be discarded.

Makes a new DateTime from the current date, hour, minute, second and nanosecond. The nanosecond part can exceed 1,000,000,000 in order to represent the leap second. The offset in the current date is preserved.

Propagates any error. Ambiguous result would be discarded.

Returns the single unique conversion result, or panics accordingly.

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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.