Debian Codegraph @

src/iter/iterinfo.rs

raw symbols SCIP
1 use superrust-analyzer cargo rrule 0.14.0 iter/::counter_daterust-analyzer cargo rrule 0.14.0 iter/counter_date/::DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#;
2 #[cfg(feature = "by-easter")]
3 use superrust-analyzer cargo rrule 0.14.0 iter/::easterrust-analyzer cargo rrule 0.14.0 iter/easter/::easterrust-analyzer cargo rrule 0.14.0 iter/easter/easter().;
4 use superrust-analyzer cargo rrule 0.14.0 iter/::{monthinforust-analyzer cargo rrule 0.14.0 iter/monthinfo/::MonthInforust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#, yearinforust-analyzer cargo rrule 0.14.0 iter/yearinfo/::YearInforust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#};
5 use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::get_monthrust-analyzer cargo rrule 0.14.0 core/datetime/get_month().;
6 use craterust-analyzer cargo rrule 0.14.0 crate/::{Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#, NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#, RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#, Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#};
7 use chronorust-analyzer cargo chrono 0.4.40 crate/::{Datelikerust-analyzer cargo chrono 0.4.40 traits/Datelike#, NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#, TimeZonerust-analyzer cargo chrono 0.4.40 offset/TimeZone#};
8
9 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
10 pub(craterust-analyzer cargo rrule 0.14.0 crate/) struct IterInforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo# {
11 year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info.: YearInforust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#,
12 month_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#month_info.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MonthInforust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#>,
13 easter_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#easter_mask.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>>,
14 rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.: RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#,
15 }
16
17 impl IterInforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo# {
18 pub fn newrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]new().(rrule: &RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#, dt_start: &chronorust-analyzer cargo chrono 0.4.40 crate/::DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>) -> Selfrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo] {
19 let year = dt_start.yearrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]year().();
20 let month = get_monthrust-analyzer cargo rrule 0.14.0 core/datetime/get_month().(dt_start);
21
22 let year_info = YearInforust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#::newrust-analyzer cargo rrule 0.14.0 iter/yearinfo/impl#[YearInfo]new().(year, rrule);
23 let mut ii = Selfrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo] {
24 rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.: rrule.clonerust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Stage>`][Clone]clone().(),
25 year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info.,
26 month_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#month_info.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
27 easter_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#easter_mask.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
28 };
29 ii.rebuild_innerrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rebuild_inner().(year, month, true);
30
31 ii
32 }
33
34 fn rebuild_innerrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rebuild_inner().(&mut self, year: i32, month: u8, skip_year_info: bool) {
35 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().skip_year_info
36 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(&self.month_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#month_info., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(month_info) if month_info.last_yearrust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#last_year. == year)
37 {
38 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info. = YearInforust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#::newrust-analyzer cargo rrule 0.14.0 iter/yearinfo/impl#[YearInfo]new().(year, &self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.);
39 }
40
41 let contains_nth_by_weekday = self
42 .rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.
43 .by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday.
44 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
45 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|by_weekday| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(by_weekday, NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(_, _)));
46
47 if contains_nth_by_weekday
48 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(&self.month_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#month_info., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(month_info) if month_info.last_monthrust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#last_month. == month && month_info.last_yearrust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#last_year. == year))
49 {
50 let new_month_info = MonthInforust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#::newrust-analyzer cargo rrule 0.14.0 iter/monthinfo/impl#[MonthInfo]new().(&self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info., month, &self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.);
51 self.month_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#month_info. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_month_info);
52 }
53
54 #[cfg(feature = "by-easter")]
55 {
56 self.easter_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#easter_mask. = self
57 .rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.
58 .by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter.
59 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_easter| vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![easterrust-analyzer cargo rrule 0.14.0 iter/easter/easter().(year, by_easter)]);
60 }
61 }
62
63 pub fn rebuildrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rebuild().(&mut self, counter_date: &DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#) {
64 let month = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(counter_date.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month.).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("range 1-12 is covered by u8");
65 self.rebuild_innerrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rebuild_inner().(counter_date.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year., month, false);
66 }
67
68 pub fn year_lenrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_len().(&self) -> u16 {
69 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..year_lenrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#year_len.
70 }
71
72 pub fn year_ordinalrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_ordinal().(&self) -> i64 {
73 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..year_ordinalrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#year_ordinal.
74 }
75
76 pub fn month_rangerust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]month_range().(&self) -> &[u16] {
77 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..month_rangerust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#month_range.
78 }
79
80 pub fn easter_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]easter_mask().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>> {
81 self.easter_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#easter_mask..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
82 }
83
84 pub fn weekday_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]weekday_mask().(&self) -> &[u32] {
85 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..weekday_maskrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#weekday_mask.
86 }
87
88 pub fn month_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]month_mask().(&self) -> &[u8] {
89 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..month_maskrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#month_mask.
90 }
91
92 pub fn week_no_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]week_no_mask().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> {
93 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..week_no_maskrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#week_no_mask..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
94 }
95
96 pub fn neg_weekday_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]neg_weekday_mask().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> {
97 self.month_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#month_info..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|info| &info.neg_weekday_maskrust-analyzer cargo rrule 0.14.0 iter/monthinfo/MonthInfo#neg_weekday_mask.)
98 }
99
100 pub fn next_year_lenrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]next_year_len().(&self) -> u16 {
101 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..next_year_lenrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#next_year_len.
102 }
103
104 pub fn month_day_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]month_day_mask().(&self) -> &[i8] {
105 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..month_day_maskrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#month_day_mask.
106 }
107
108 pub fn neg_month_day_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]neg_month_day_mask().(&self) -> &[i8] {
109 self.year_inforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#year_info..neg_month_day_maskrust-analyzer cargo rrule 0.14.0 iter/yearinfo/YearInfo#neg_month_day_mask.
110 }
111
112 pub fn year_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_dayset().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> {
113 let year_len = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(self.year_lenrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_len().());
114 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#year_len).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
115 }
116
117 pub fn month_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]month_dayset().(&self, month: u32) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> {
118 let month_range = self.month_rangerust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]month_range().();
119 let month = usize::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[usize][`TryFrom<u32>`]try_from().(month).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("target arch should have at least 32 bits");
120 let start = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(month_range[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().month rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
121 let end = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(month_range[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().month]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
122 (start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
123 }
124
125 pub fn weekday_setrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]weekday_set().(&self, year: i32, month: u32, day: u32) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> {
126 let set_len = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u16>`]from().(self.year_lenrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().7);
127
128 let mut date_ordinal = usize::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[usize][`TryFrom<u32>`]try_from().(
129 chronorust-analyzer cargo chrono 0.4.40 crate/::Utcrust-analyzer cargo chrono 0.4.40 offset/utc/Utc#
130 .with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(year, month, day, 0, 0, 0)
131 .unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().()
132 .ordinal0rust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]ordinal0().(),
133 )
134 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("target arch should have at least 32 bits");
135
136 let mut set = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
137
138 let week_start_num_days_from_monday = self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start..num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().();
139
140 for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#7 {
141 if date_ordinal rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().set_len {
142 break;
143 }
144 set.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(date_ordinal);
145 date_ordinal rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
146 if self.weekday_maskrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]weekday_mask().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().date_ordinal]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().week_start_num_days_from_monday {
147 break;
148 }
149 }
150
151 set
152 }
153
154 pub fn day_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]day_dayset().(year: i32, month: u32, day: u32) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> {
155 let date_ordinal = chronorust-analyzer cargo chrono 0.4.40 crate/::Utcrust-analyzer cargo chrono 0.4.40 offset/utc/Utc#
156 .with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(year, month, day, 0, 0, 0)
157 .unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().()
158 .ordinal0rust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]ordinal0().();
159
160 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![usize::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[usize][`TryFrom<u32>`]try_from().(date_ordinal).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("target arch should have at least 32 bits")]
161 }
162
163 pub fn hour_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]hour_timeset().(&self, hour: u8) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#> {
164 self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.
165 .by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute.
166 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
167 .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|minute| self.min_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]min_timeset().(hour, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().minute))
168 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
169 }
170
171 pub fn min_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]min_timeset().(&self, hour: u8, minute: u8) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#> {
172 self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.
173 .by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second.
174 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
175 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|second| {
176 NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#::from_hms_optrust-analyzer cargo chrono 0.4.40 naive/time/impl#[NaiveTime]from_hms_opt().(u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(hour), u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(minute), u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().second))
177 })
178 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
179 }
180
181 pub fn sec_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]sec_timeset().(hour: u8, minute: u8, second: u8) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#> {
182 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(time) =
183 NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#::from_hms_optrust-analyzer cargo chrono 0.4.40 naive/time/impl#[NaiveTime]from_hms_opt().(u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(hour), u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(minute), u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(second))
184 {
185 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![time]
186 } else {
187 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]
188 }
189 }
190
191 pub fn get_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_dayset().(&self, freq: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#, year: i32, month: u32, day: u32) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> {
192 let mut dayset = match freq {
193 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly# => self.year_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_dayset().(),
194 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly# => self.month_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]month_dayset().(month),
195 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly# => self.weekday_setrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]weekday_set().(year, month, day),
196 _ => Selfrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]::day_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]day_dayset().(year, month, day),
197 };
198
199 // Filter out days according to the RRule filters.
200 dayset.retainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]retain().(|day| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().superrust-analyzer cargo rrule 0.14.0 iter/::filtersrust-analyzer cargo rrule 0.14.0 iter/filters/::is_filteredrust-analyzer cargo rrule 0.14.0 iter/filters/is_filtered().(self, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().day));
201
202 dayset
203 }
204
205 /// Gets a timeset without checking if the hour, minute and second are valid, according
206 /// to the `RRule`.
207 ///
208 /// This is usually called after calling the `increment_counter_date` where we know
209 /// that we get a valid `DateTime` back, and there is no need to do any duplicate
210 /// validation.
211 pub fn get_timeset_uncheckedrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_timeset_unchecked().(&self, hour: u8, minute: u8, second: u8) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#> {
212 match self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. {
213 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# => self.hour_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]hour_timeset().(hour),
214 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# => self.min_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]min_timeset().(hour, minute),
215 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# => Selfrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]::sec_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]sec_timeset().(hour, minute, second),
216 _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(
217 "This method is never called with an invalid frequency and is not publicly exposed"
218 ),
219 }
220 }
221
222 /// Gets a timeset.
223 ///
224 /// An empty set is returned if the hour, minute and second aren't valid,
225 /// according to the `RRule`.
226 pub fn get_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_timeset().(&self, hour: u8, minute: u8, second: u8) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#> {
227 match self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. {
228 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# => {
229 let incorrect_hour = self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly#
230 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()
231 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&hour);
232 let incorrect_minute = self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely#
233 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()
234 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&minute);
235 let incorrect_second = self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly#
236 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()
237 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&second);
238 let date_is_not_a_candidate =
239 incorrect_hour || incorrect_minute || incorrect_second;
240
241 // If date is not a potential candidate, then we return an empty timeset.
242 if date_is_not_a_candidate {
243 return vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
244 }
245
246 self.get_timeset_uncheckedrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_timeset_unchecked().(hour, minute, second)
247 }
248 _ => {
249 let timeset = self
250 .rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.
251 .by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour.
252 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
253 .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|hour| {
254 self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(move |minute| {
255 self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule..by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(move |second| {
256 NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#::from_hms_optrust-analyzer cargo chrono 0.4.40 naive/time/impl#[NaiveTime]from_hms_opt().(
257 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().hour),
258 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().minute),
259 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().second),
260 )
261 })
262 })
263 })
264 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
265
266 timeset
267 }
268 }
269 }
270
271 pub fn rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rrule().(&self) -> &RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
272 &self.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#rrule.
273 }
274 }