Enum TzEnv

pub enum TzEnv

The result of parsing the POSIX TZ environment variable.

A TZ variable can either be a POSIX time zone string with an optional DST transition rule, or it can begin with a : followed by an arbitrary set of bytes that is implementation defined.

In practice, the content following a : is treated as an IANA time zone name. Moreover, even if the TZ string doesn't start with a : but corresponds to a IANA time zone name, then it is interpreted as such. However, this type only encapsulates the choices strictly provided by POSIX: either a time zone string with an optional DST transition rule, or an implementation defined string with a : prefix. If, for example, TZ="America/New_York", then that case isn't encapsulated by this type. Callers needing that functionality will need to handle the error returned by parsing this type and layer their own semantics on top. In general, any valid IANA time zone identifier will be an invalid POSIX time zone string.

Variants

Rule(TimeZone)

A valid POSIX time zone with an optional DST transition rule.

Implementation(TimeZoneId)

An implementation defined string. This occurs when the TZ value starts with a :. The string stored here does not include the :.

Typically this is an IANA time zone identifier.

Implementations

impl TzEnv

fn parse<B: AsRef<[u8]>>(bytes: B) -> Result<TzEnv, ParseError>

Parse a POSIX TZ environment variable string from the given bytes.

fn parse_os_str<O: AsRef<OsStr>>(osstr: O) -> Result<TzEnv, ParseError>

Parse a POSIX TZ environment variable string from the given OsStr.

Trait Implementations

impl Debug for TzEnv

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

impl Eq for TzEnv

impl PartialEq for TzEnv

fn eq(&self, other: &TzEnv) -> bool

impl StructuralPartialEq for TzEnv

Auto Trait Implementations

impl Freeze for TzEnv

impl RefUnwindSafe for TzEnv

impl Send for TzEnv

impl Sync for TzEnv

impl Unpin for TzEnv

impl UnsafeUnpin for TzEnv

impl UnwindSafe for TzEnv

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for TzEnv

fn from(t: T) -> T

Returns the argument unchanged.

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

fn into(self) -> U

Calls U::from(self).

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

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

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

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

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