Skip to main content

Zone

Struct Zone 

Source
pub struct Zone { /* private fields */ }
Expand description

A parsed IANA timezone, exposing transitions, zone types, leap seconds, and the POSIX TZ extend rule.

Instances come from load and reference &'static data generated at build time; Zone is Copy.

Implementations§

Source§

impl Zone

Source

pub fn name(&self) -> &'static str

The IANA timezone name.

Source

pub fn version(&self) -> u8

The TZif format version the data was compiled from (1, 2, 3, or 4).

Source

pub fn types(&self) -> &'static [ZoneType]

The zone’s local time types.

Source

pub fn transitions(&self) -> &'static [Transition]

The stored transition records.

Source

pub fn leap_seconds(&self) -> &'static [LeapSecond]

The leap-second records.

Source

pub fn extend(&self) -> Option<&PosixTz<'static>>

The parsed POSIX TZ rule for computing future transitions, if any.

Source

pub fn extend_raw(&self) -> &'static str

The raw POSIX TZ footer string (empty if none).

Source

pub fn type_count(&self) -> usize

The number of local time types.

Source

pub fn type_at(&self, i: usize) -> ZoneType

Returns the i-th local time type. Panics if i >= types().len().

Source

pub fn lookup(&self, unix: i64) -> ZoneType

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.

Source

pub fn transitions_for_range(&self, start_unix: i64, end_unix: i64) -> RangeIter

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.

Source§

impl Zone

Source

pub fn meta(&self) -> Option<ZoneMeta<'static>>

Returns metadata (countries, coordinates) for this timezone, or None.

Trait Implementations§

Source§

impl Clone for Zone

Source§

fn clone(&self) -> Zone

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Zone

Source§

impl Debug for Zone

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Zone

§

impl RefUnwindSafe for Zone

§

impl Send for Zone

§

impl Sync for Zone

§

impl Unpin for Zone

§

impl UnsafeUnpin for Zone

§

impl UnwindSafe for Zone

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.