pub enum TimeResult {
One(Time),
Two(Time, Time),
Many(Time),
DidNotExist(Time, Time),
}Expand description
The result of trying to figure out what real-world time matches a given written time
Variants§
One(Time)
The written time matches exactly one real-world time
This is the “normal path.”
Two(Time, Time)
The written time matches two real-world times
This happens relatively often, eg. when a timezone goes back in time.
Many(Time)
The written time matches many real-world times
This should happen very rarely, but can theoretically happen, eg. if a backwards leap second happens while a timezone is going back in time then there would be three possible real-world times matching this Time. Given how rare this should be (basically, probably never actually happen until all programs using this crate are long forgotten), in this scenario a single example value is returned.
DidNotExist(Time, Time)
The written time never actually happened
In this case, the two times returned are the one just before the time at which this written time would have been if it existed, and the one just after.
Implementations§
Source§impl TimeResult
impl TimeResult
Sourcepub fn any_approximate(self) -> Time
pub fn any_approximate(self) -> Time
Returns any point in time that matches the given written time
Note that if the written time did not exist, this will return an approximate version of what it would have been if it did actually exist.
Trait Implementations§
Source§impl Clone for TimeResult
impl Clone for TimeResult
Source§fn clone(&self) -> TimeResult
fn clone(&self) -> TimeResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimeResult
impl Debug for TimeResult
Source§impl PartialEq for TimeResult
impl PartialEq for TimeResult
Source§fn eq(&self, other: &TimeResult) -> bool
fn eq(&self, other: &TimeResult) -> bool
self and other values to be equal, and is used by ==.