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
TZvalue 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
TZenvironment variable string from the given bytes.fn parse_os_str<O: AsRef<OsStr>>(osstr: O) -> Result<TzEnv, ParseError>Parse a POSIX
TZenvironment variable string from the givenOsStr.
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: &Self) -> bool