pub(crate) enum TimeZoneAbbreviation<'t> {
Borrowed(&'t str),
Owned(ArrayStr<9>),
}
Expand description
A light abstraction over different representations of a time zone abbreviation.
The lifetime parameter 't
corresponds to the lifetime of the time zone
that produced this abbreviation.
Variants§
Borrowed(&'t str)
For when the abbreviation is borrowed directly from other data. For example, from TZif or from POSIX TZ strings.
Owned(ArrayStr<9>)
For when the abbreviation has to be derived from other data. For example, from a fixed offset.
The idea here is that a TimeZone
shouldn’t need to store the
string representation of a fixed offset. Particularly in core-only
environments, this is quite wasteful. So we make the string on-demand
only when it’s requested.
An alternative design is to just implement Display
and reuse
Offset
’s Display
impl, but then we couldn’t offer a -> &str
API.
I feel like that’s just a bit overkill, and really just comes from the
core-only straight-jacket.
Implementations§
Trait Implementations§
Source§impl<'t> Clone for TimeZoneAbbreviation<'t>
impl<'t> Clone for TimeZoneAbbreviation<'t>
Source§fn clone(&self) -> TimeZoneAbbreviation<'t>
fn clone(&self) -> TimeZoneAbbreviation<'t>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more