Enum LocalResult
enum LocalResult<T>
Old name of MappedLocalTime. See that type for more documentation.
Variants
-
Single(T) The local time maps to a single unique result.
-
Ambiguous(T, T) The local time is ambiguous because there is a fold in the local time.
This variant contains the two possible results, in the order
(earliest, latest).-
None The local time does not exist because there is a gap in the local time.
This variant may also be returned if there was an error while resolving the local time, caused by for example missing time zone data files, an error in an OS API, or overflow.
Implementations
impl<T> LocalResult<T>
fn single(self: Self) -> Option<T>Returns
Someif the time zone mapping has a single result.Errors
Returns
Noneif local time falls in a fold or gap in the local time, or if there was an error.fn earliest(self: Self) -> Option<T>Returns the earliest possible result of the time zone mapping.
Errors
Returns
Noneif local time falls in a gap in the local time, or if there was an error.fn latest(self: Self) -> Option<T>Returns the latest possible result of the time zone mapping.
Errors
Returns
Noneif local time falls in a gap in the local time, or if there was an error.fn map<U, F: FnMut(T) -> U>(self: Self, f: F) -> MappedLocalTime<U>Maps a
MappedLocalTime<T>intoMappedLocalTime<U>with given function.
impl<T: fmt::Debug> LocalResult<T>
fn unwrap(self: Self) -> TReturns a single unique conversion result or panics.
unwrap()is best combined with time zone types where the mapping can never fail likeUtcandFixedOffset. Note that forFixedOffsetthere is a rare case where a resultingDateTimecan be out of range.Panics
Panics if the local time falls within a fold or a gap in the local time, and on any error that may have been returned by the type implementing
TimeZone.
impl<Tz: TimeZone> LocalResult<Date<Tz>>
fn and_time(self: Self, time: NaiveTime) -> MappedLocalTime<DateTime<Tz>>Makes a new
DateTimefrom the current date and givenNaiveTime. The offset in the current date is preserved.Propagates any error. Ambiguous result would be discarded.
fn and_hms_opt(self: Self, hour: u32, min: u32, sec: u32) -> MappedLocalTime<DateTime<Tz>>Makes a new
DateTimefrom the current date, hour, minute and second. The offset in the current date is preserved.Propagates any error. Ambiguous result would be discarded.
fn and_hms_milli_opt(self: Self, hour: u32, min: u32, sec: u32, milli: u32) -> MappedLocalTime<DateTime<Tz>>Makes a new
DateTimefrom 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.
fn and_hms_micro_opt(self: Self, hour: u32, min: u32, sec: u32, micro: u32) -> MappedLocalTime<DateTime<Tz>>Makes a new
DateTimefrom 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.
fn and_hms_nano_opt(self: Self, hour: u32, min: u32, sec: u32, nano: u32) -> MappedLocalTime<DateTime<Tz>>Makes a new
DateTimefrom 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.
impl<T> Any for LocalResult<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for LocalResult<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for LocalResult<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for LocalResult<T>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> Freeze for LocalResult<T>
impl<T> From for LocalResult<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> RefUnwindSafe for LocalResult<T>
impl<T> Send for LocalResult<T>
impl<T> StructuralPartialEq for LocalResult<T>
impl<T> Sync for LocalResult<T>
impl<T> ToOwned for LocalResult<T>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> Unpin for LocalResult<T>
impl<T> UnwindSafe for LocalResult<T>
impl<T, U> Into for LocalResult<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for LocalResult<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for LocalResult<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T: $crate::clone::Clone> Clone for LocalResult<T>
fn clone(self: &Self) -> LocalResult<T>
impl<T: $crate::cmp::Eq> Eq for LocalResult<T>
impl<T: $crate::cmp::PartialEq> PartialEq for LocalResult<T>
fn eq(self: &Self, other: &LocalResult<T>) -> bool
impl<T: $crate::fmt::Debug> Debug for LocalResult<T>
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl<T: $crate::hash::Hash> Hash for LocalResult<T>
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)