pub trait Localize:
Clone
+ Send
+ Sync {
type DateTime: Clone + Add<Duration, Output = Self::DateTime>;
// Required methods
fn naive(&self, dt: Self::DateTime) -> NaiveDateTime;
fn datetime(&self, naive: NaiveDateTime) -> Self::DateTime;
// Provided method
fn event_time(&self, _date: NaiveDate, event: TimeEvent) -> NaiveTime { ... }
}Expand description
Specifies how dates should be localized while evaluating opening hours. No localisation is available by default but this can be used to specify a timezone and coordinates (which affect sun events).
Required Associated Types§
Required Methods§
Sourcefn naive(&self, dt: Self::DateTime) -> NaiveDateTime
fn naive(&self, dt: Self::DateTime) -> NaiveDateTime
Get naive local time.
Sourcefn datetime(&self, naive: NaiveDateTime) -> Self::DateTime
fn datetime(&self, naive: NaiveDateTime) -> Self::DateTime
Localize a naive datetime.
Provided Methods§
Sourcefn event_time(&self, _date: NaiveDate, event: TimeEvent) -> NaiveTime
fn event_time(&self, _date: NaiveDate, event: TimeEvent) -> NaiveTime
Get the localized time for a sun event at a given date.
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.