pub struct TimeZoneRef<'a> { /* private fields */ }
Expand description
Reference to a time zone
Implementations§
Source§impl<'a> TimeZoneRef<'a>
impl<'a> TimeZoneRef<'a>
Sourcepub const fn new(
transitions: &'a [Transition],
local_time_types: &'a [LocalTimeType],
leap_seconds: &'a [LeapSecond],
extra_rule: &'a Option<TransitionRule>,
) -> Result<Self, TzError>
pub const fn new( transitions: &'a [Transition], local_time_types: &'a [LocalTimeType], leap_seconds: &'a [LeapSecond], extra_rule: &'a Option<TransitionRule>, ) -> Result<Self, TzError>
Construct a time zone reference
Examples found in repository?
examples/statics.rs (lines 15-53)
15 const TIME_ZONE_REF: TimeZoneRef<'static> = unwrap!(TimeZoneRef::new(
16 &[
17 Transition::new(-2334101314, 1),
18 Transition::new(-1157283000, 2),
19 Transition::new(-1155436200, 1),
20 Transition::new(-880198200, 3),
21 Transition::new(-769395600, 4),
22 Transition::new(-765376200, 1),
23 Transition::new(-712150200, 5),
24 ],
25 const {
26 &[
27 unwrap!(LocalTimeType::new(-37886, false, Some(b"LMT"))),
28 unwrap!(LocalTimeType::new(-37800, false, Some(b"HST"))),
29 unwrap!(LocalTimeType::new(-34200, true, Some(b"HDT"))),
30 unwrap!(LocalTimeType::new(-34200, true, Some(b"HWT"))),
31 unwrap!(LocalTimeType::new(-34200, true, Some(b"HPT"))),
32 unwrap!(LocalTimeType::new(-36000, false, Some(b"HST"))),
33 ]
34 },
35 &[
36 LeapSecond::new(78796800, 1),
37 LeapSecond::new(94694401, 2),
38 LeapSecond::new(126230402, 3),
39 LeapSecond::new(157766403, 4),
40 LeapSecond::new(189302404, 5),
41 LeapSecond::new(220924805, 6),
42 ],
43 const {
44 &Some(TransitionRule::Alternate(unwrap!(AlternateTime::new(
45 unwrap!(LocalTimeType::new(-36000, false, Some(b"HST"))),
46 unwrap!(LocalTimeType::new(-34200, true, Some(b"HPT"))),
47 RuleDay::MonthWeekDay(unwrap!(MonthWeekDay::new(10, 5, 0))),
48 93600,
49 RuleDay::MonthWeekDay(unwrap!(MonthWeekDay::new(3, 4, 4))),
50 7200,
51 ))))
52 },
53 ));
Sourcepub const fn transitions(&self) -> &'a [Transition]
pub const fn transitions(&self) -> &'a [Transition]
Returns list of transitions
Sourcepub const fn local_time_types(&self) -> &'a [LocalTimeType]
pub const fn local_time_types(&self) -> &'a [LocalTimeType]
Returns list of local time types
Sourcepub const fn leap_seconds(&self) -> &'a [LeapSecond]
pub const fn leap_seconds(&self) -> &'a [LeapSecond]
Returns list of leap seconds
Sourcepub const fn extra_rule(&self) -> &'a Option<TransitionRule>
pub const fn extra_rule(&self) -> &'a Option<TransitionRule>
Returns extra transition rule applicable after the last transition
Sourcepub const fn find_local_time_type(
&self,
unix_time: i64,
) -> Result<&'a LocalTimeType, TzError>
pub const fn find_local_time_type( &self, unix_time: i64, ) -> Result<&'a LocalTimeType, TzError>
Find the local time type associated to the time zone at the specified Unix time in seconds
Trait Implementations§
Source§impl<'a> Clone for TimeZoneRef<'a>
impl<'a> Clone for TimeZoneRef<'a>
Source§fn clone(&self) -> TimeZoneRef<'a>
fn clone(&self) -> TimeZoneRef<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for TimeZoneRef<'a>
impl<'a> Debug for TimeZoneRef<'a>
Source§impl<'a> PartialEq for TimeZoneRef<'a>
impl<'a> PartialEq for TimeZoneRef<'a>
impl<'a> Copy for TimeZoneRef<'a>
impl<'a> Eq for TimeZoneRef<'a>
impl<'a> StructuralPartialEq for TimeZoneRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for TimeZoneRef<'a>
impl<'a> RefUnwindSafe for TimeZoneRef<'a>
impl<'a> Send for TimeZoneRef<'a>
impl<'a> Sync for TimeZoneRef<'a>
impl<'a> Unpin for TimeZoneRef<'a>
impl<'a> UnwindSafe for TimeZoneRef<'a>
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