pub(crate) struct TimeZone {
transitions: Vec<Transition>,
local_time_types: Vec<LocalTimeType>,
leap_seconds: Vec<LeapSecond>,
extra_rule: Option<TransitionRule>,
}
Expand description
Time zone
Fields§
§transitions: Vec<Transition>
List of transitions
local_time_types: Vec<LocalTimeType>
List of local time types (cannot be empty)
leap_seconds: Vec<LeapSecond>
List of leap seconds
extra_rule: Option<TransitionRule>
Extra transition rule applicable after the last transition
Implementations§
source§impl TimeZone
impl TimeZone
sourcepub(crate) fn local(env_tz: Option<&str>) -> Result<Self, Error>
pub(crate) fn local(env_tz: Option<&str>) -> Result<Self, Error>
Returns local time zone.
This method in not supported on non-UNIX platforms, and returns the UTC time zone instead.
sourcefn from_posix_tz(tz_string: &str) -> Result<Self, Error>
fn from_posix_tz(tz_string: &str) -> Result<Self, Error>
Construct a time zone from a POSIX TZ string, as described in the POSIX documentation of the TZ
environment variable.
sourcepub(super) fn new(
transitions: Vec<Transition>,
local_time_types: Vec<LocalTimeType>,
leap_seconds: Vec<LeapSecond>,
extra_rule: Option<TransitionRule>,
) -> Result<Self, Error>
pub(super) fn new( transitions: Vec<Transition>, local_time_types: Vec<LocalTimeType>, leap_seconds: Vec<LeapSecond>, extra_rule: Option<TransitionRule>, ) -> Result<Self, Error>
Construct a time zone
sourcefn from_file(file: &mut File) -> Result<Self, Error>
fn from_file(file: &mut File) -> Result<Self, Error>
Construct a time zone from the contents of a time zone file
sourcepub(crate) fn from_tz_data(bytes: &[u8]) -> Result<Self, Error>
pub(crate) fn from_tz_data(bytes: &[u8]) -> Result<Self, Error>
Construct a time zone from the contents of a time zone file
Parse TZif data as described in RFC 8536.
sourcefn fixed(ut_offset: i32) -> Result<Self, Error>
fn fixed(ut_offset: i32) -> Result<Self, Error>
Construct a time zone with the specified UTC offset in seconds
sourcepub(crate) fn find_local_time_type(
&self,
unix_time: i64,
) -> Result<&LocalTimeType, Error>
pub(crate) fn find_local_time_type( &self, unix_time: i64, ) -> Result<&LocalTimeType, Error>
Find the local time type associated to the time zone at the specified Unix time in seconds
pub(crate) fn find_local_time_type_from_local( &self, local_time: i64, year: i32, ) -> Result<MappedLocalTime<LocalTimeType>, Error>
sourcefn as_ref(&self) -> TimeZoneRef<'_>
fn as_ref(&self) -> TimeZoneRef<'_>
Returns a reference to the time zone
Trait Implementations§
source§impl PartialEq for TimeZone
impl PartialEq for TimeZone
impl Eq for TimeZone
impl StructuralPartialEq for TimeZone
Auto Trait Implementations§
impl Freeze for TimeZone
impl RefUnwindSafe for TimeZone
impl Send for TimeZone
impl Sync for TimeZone
impl Unpin for TimeZone
impl UnwindSafe for TimeZone
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more