pub struct Zone<'a> { /* private fields */ }Expand description
A parsed IANA timezone with all raw data exposed.
Zone borrows the TZif bytes it was parsed from; it is cheap to copy.
Implementations§
Source§impl<'a> Zone<'a>
impl<'a> Zone<'a>
Sourcepub fn extend(&self) -> Option<&PosixTz<'a>>
pub fn extend(&self) -> Option<&PosixTz<'a>>
The parsed POSIX TZ rule for computing future transitions, if any.
Sourcepub fn extend_raw(&self) -> &'a str
pub fn extend_raw(&self) -> &'a str
The raw POSIX TZ footer string (empty if none).
Sourcepub fn type_count(&self) -> usize
pub fn type_count(&self) -> usize
The number of local time types.
Sourcepub fn type_at(&self, i: usize) -> ZoneType<'a>
pub fn type_at(&self, i: usize) -> ZoneType<'a>
Returns the i-th local time type. Panics if i >= type_count().
Sourcepub fn types(&self) -> impl Iterator<Item = ZoneType<'a>> + 'a
pub fn types(&self) -> impl Iterator<Item = ZoneType<'a>> + 'a
Iterates over the zone’s local time types.
Sourcepub fn transitions(&self) -> impl Iterator<Item = Transition> + 'a
pub fn transitions(&self) -> impl Iterator<Item = Transition> + 'a
Iterates over the stored transition records.
Sourcepub fn leap_seconds(&self) -> impl Iterator<Item = LeapSecond> + 'a
pub fn leap_seconds(&self) -> impl Iterator<Item = LeapSecond> + 'a
Iterates over the leap-second records.
Sourcepub fn lookup(&self, unix: i64) -> ZoneType<'a>
pub fn lookup(&self, unix: i64) -> ZoneType<'a>
Returns the zone type in effect at the given Unix timestamp.
Searches stored transitions and falls back to the POSIX TZ rule for times after the last transition.
Sourcepub fn transitions_for_range(
&self,
start_unix: i64,
end_unix: i64,
) -> RangeIter<'a>
pub fn transitions_for_range( &self, start_unix: i64, end_unix: i64, ) -> RangeIter<'a>
Returns transitions in the half-open interval [start_unix, end_unix),
combining stored transitions with ones generated from the POSIX TZ
extend rule. The result is yielded in chronological order.