FromDateTime

Trait FromDateTime 

Source
pub trait FromDateTime: Sized {
    type Error: Error;

    // Required method
    fn from_datetime(
        date: Date,
        hour: u8,
        minute: u8,
        second: u8,
    ) -> Result<Self, Self::Error>;
}
Expand description

This trait may be implemented for time points that can be constructed based on a date-time pair: they can connect a date and time-of-day to a specific time instant within their internal scale and vice versa.

Required Associated Types§

Source

type Error: Error

This error may be returned whenever some input date-time is not valid. This may be the case when the time-of-day is not valid, but also when some date-time does not occur in a chosen time scale, for example due to leap seconds deletions or daylight saving time switches.

Required Methods§

Source

fn from_datetime( date: Date, hour: u8, minute: u8, second: u8, ) -> Result<Self, Self::Error>

Maps a given combination of date and time-of-day to an instant on this time scale. May return an error if the input does not represent a valid combination of date and time-of-day.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl FromDateTime for UtcTime

Source§

impl<Scale> FromDateTime for TimePoint<Scale>
where Scale: ?Sized + UniformDateTimeScale,

Source§

impl<TimePoint> FromDateTime for TimePoint
where TimePoint: FromLeapSecondDateTime,

We provide a default implementation that uses the static leap second provider.