pub struct TimeZone { /* private fields */ }
Available on crate feature
alloc
only.Expand description
Time zone
Implementations§
Source§impl TimeZone
impl TimeZone
Sourcepub fn new(
transitions: Vec<Transition>,
local_time_types: Vec<LocalTimeType>,
leap_seconds: Vec<LeapSecond>,
extra_rule: Option<TransitionRule>,
) -> Result<Self, TimeZoneError>
pub fn new( transitions: Vec<Transition>, local_time_types: Vec<LocalTimeType>, leap_seconds: Vec<LeapSecond>, extra_rule: Option<TransitionRule>, ) -> Result<Self, TimeZoneError>
Construct a time zone
Sourcepub fn as_ref(&self) -> TimeZoneRef<'_>
pub fn as_ref(&self) -> TimeZoneRef<'_>
Returns a reference to the time zone
Sourcepub fn fixed(ut_offset: i32) -> Result<Self, LocalTimeTypeError>
pub fn fixed(ut_offset: i32) -> Result<Self, LocalTimeTypeError>
Construct a time zone with the specified UTC offset in seconds
Sourcepub fn local() -> Result<Self, TzError>
Available on crate feature std
only.
pub fn local() -> Result<Self, TzError>
std
only.Returns local time zone.
This method in not supported on non-UNIX platforms, and returns the UTC time zone instead.
Sourcepub fn from_tz_data(bytes: &[u8]) -> Result<Self, TzError>
Available on crate feature std
only.
pub fn from_tz_data(bytes: &[u8]) -> Result<Self, TzError>
std
only.Construct a time zone from the contents of a time zone file
Sourcepub fn from_posix_tz(tz_string: &str) -> Result<Self, TzError>
Available on crate feature std
only.
pub fn from_posix_tz(tz_string: &str) -> Result<Self, TzError>
std
only.Construct a time zone from a POSIX TZ string, as described in the POSIX documentation of the TZ
environment variable.
Sourcepub fn find_current_local_time_type(&self) -> Result<&LocalTimeType, TzError>
Available on crate feature std
only.
pub fn find_current_local_time_type(&self) -> Result<&LocalTimeType, TzError>
std
only.Find the current local time type associated to the time zone
Sourcepub fn find_local_time_type(
&self,
unix_time: i64,
) -> Result<&LocalTimeType, FindLocalTimeTypeError>
pub fn find_local_time_type( &self, unix_time: i64, ) -> Result<&LocalTimeType, FindLocalTimeTypeError>
Find the local time type associated to the time zone at the specified Unix time in seconds
Trait Implementations§
impl Eq for TimeZone
impl StructuralPartialEq for TimeZone
Auto Trait Implementations§
impl Freeze for TimeZone
impl RefUnwindSafe for TimeZone
impl Send for TimeZone
impl Sync for TimeZone
impl Unpin for TimeZone
impl UnwindSafe for TimeZone
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more