pub trait PrimitiveDateTimeExt: PrimitiveDateTimeExt {
// Required methods
fn assume_timezone<T: TimeZone>(
&self,
tz: &T,
) -> OffsetResult<OffsetDateTime>;
fn assume_timezone_utc<T: TimeZone>(&self, tz: &T) -> OffsetDateTime;
}
Expand description
This trait is sealed and is only implemented in this library.
Required Methods§
Sourcefn assume_timezone<T: TimeZone>(&self, tz: &T) -> OffsetResult<OffsetDateTime>
fn assume_timezone<T: TimeZone>(&self, tz: &T) -> OffsetResult<OffsetDateTime>
Creates a new OffsetDateTime from a PrimitiveDateTime by assigning the main offset of the target timezone.
This assumes the PrimitiveDateTime is already in the target timezone.
§Arguments
tz
: the target timezone.
returns: OffsetResult<OffsetDateTime>
Sourcefn assume_timezone_utc<T: TimeZone>(&self, tz: &T) -> OffsetDateTime
fn assume_timezone_utc<T: TimeZone>(&self, tz: &T) -> OffsetDateTime
Creates a new OffsetDateTime with the proper offset in the given timezone.
This assumes the PrimitiveDateTime is in UTC offset.
§Arguments
tz
: the target timezone.
returns: OffsetDateTime
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.