| 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 | use superrust-analyzer cargo rrule 0.14.0 iter/::utilsrust-analyzer cargo rrule 0.14.0 iter/utils/::add_time_to_daterust-analyzer cargo rrule 0.14.0 iter/utils/add_time_to_date().; |
| 3 | use superrust-analyzer cargo rrule 0.14.0 iter/::{build_pos_listrust-analyzer cargo rrule 0.14.0 iter/pos_list/build_pos_list()., utilsrust-analyzer cargo rrule 0.14.0 iter/utils/::date_from_ordinalrust-analyzer cargo rrule 0.14.0 iter/utils/date_from_ordinal()., IterInforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#, MAX_ITER_LOOPrust-analyzer cargo rrule 0.14.0 iter/MAX_ITER_LOOP.}; |
| 4 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::{get_hourrust-analyzer cargo rrule 0.14.0 core/datetime/get_hour()., get_minuterust-analyzer cargo rrule 0.14.0 core/datetime/get_minute()., get_secondrust-analyzer cargo rrule 0.14.0 core/datetime/get_second().}; |
| 5 | use craterust-analyzer cargo rrule 0.14.0 crate/::{Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#, RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#, Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#}; |
| 6 | use chronorust-analyzer cargo chrono 0.4.40 crate/::NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#; |
| 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 RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter# { |
| 11 | /// Date the iterator is currently at. |
| 12 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date.: DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#, |
| 13 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii.: IterInforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#, |
| 14 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) timesetrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#timeset.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NaiveTimerust-analyzer cargo chrono 0.4.40 naive/time/NaiveTime#>, |
| 15 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) dt_startrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#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#>, |
| 16 | /// Buffer of datetimes is not yet yielded |
| 17 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer.: VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<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#>>, |
| 18 | /// Indicate of iterator should not return more items. |
| 19 | /// Once set `true` is will always return `None`. |
| 20 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished.: bool, |
| 21 | /// Number of events that should still be generated before the end. |
| 22 | /// Counter always goes down after each iteration. |
| 23 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) countrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#count.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>, |
| 24 | /// If the iterator should be using iterator limits. |
| 25 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#limited.: bool, |
| 26 | /// If the iterator has been stopped by the iterator limits. |
| 27 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) was_limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#was_limited.: bool, |
| 28 | } |
| 29 | |
| 30 | impl RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter# { |
| 31 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) fn newrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]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#>, limited: bool) -> Selfrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter] { |
| 32 | let ii = IterInforust-analyzer cargo rrule 0.14.0 iter/iterinfo/IterInfo#::newrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]new().(rrule, dt_start); |
| 33 | |
| 34 | let hour = get_hourrust-analyzer cargo rrule 0.14.0 core/datetime/get_hour().(dt_start); |
| 35 | let minute = get_minuterust-analyzer cargo rrule 0.14.0 core/datetime/get_minute().(dt_start); |
| 36 | let second = get_secondrust-analyzer cargo rrule 0.14.0 core/datetime/get_second().(dt_start); |
| 37 | let timeset = ii.get_timesetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_timeset().(hour, minute, second); |
| 38 | let count = ii.rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rrule().().countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count.; |
| 39 | |
| 40 | Selfrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter] { |
| 41 | counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date.: dt_start.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 42 | iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii., |
| 43 | timesetrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#timeset., |
| 44 | dt_startrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#dt_start.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().dt_start, |
| 45 | bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer.: VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T>`]new().(), |
| 46 | finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished.: false, |
| 47 | countrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#count., |
| 48 | limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#limited., |
| 49 | was_limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#was_limited.: false, |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /// Attempts to add a date to the result. Returns `true` if we should |
| 54 | /// terminate the iteration. |
| 55 | fn try_add_datetimerust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]try_add_datetime().( |
| 56 | dt: 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#>, |
| 57 | rrule: &RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#, |
| 58 | count: &mut Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>, |
| 59 | buffer: &mut VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<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#>>, |
| 60 | 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#>, |
| 61 | ) -> bool { |
| 62 | if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(rrule.untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(until) if dt >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). until) { |
| 63 | // We can break because `pos_list` is sorted and |
| 64 | // all the next dates will only be larger than `until`. |
| 65 | return true; |
| 66 | } |
| 67 | |
| 68 | if dt 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().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().dt_start { |
| 69 | buffer.push_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]push_back().(dt); |
| 70 | |
| 71 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(count) = count { |
| 72 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`SubAssign<Self>`]sub_assign().1; |
| 73 | |
| 74 | if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().count 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().0 { |
| 75 | return true; |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | false |
| 80 | } |
| 81 | |
| 82 | /// Generates a list of dates that will be added to the buffer. |
| 83 | /// Returns true if finished, no more items should/can be returned. |
| 84 | fn generaterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]generate().(&mut self) -> bool { |
| 85 | // Do early check if done (if known) |
| 86 | if self.finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished. { |
| 87 | return true; |
| 88 | } |
| 89 | // Check if the count is set, and if 0 |
| 90 | if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.countrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#count., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(count) if count == 0) { |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | let rrule = self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rrule().(); |
| 95 | |
| 96 | if rrule.intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 { |
| 97 | return true; |
| 98 | } |
| 99 | |
| 100 | let mut loop_counter: u32 = 0; |
| 101 | // Loop until there is at least 1 item in the buffer. |
| 102 | while self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]is_empty().() { |
| 103 | // Prevent infinite loops |
| 104 | if self.limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#limited. { |
| 105 | loop_counter rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign().1; |
| 106 | if loop_counter rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().MAX_ITER_LOOPrust-analyzer cargo rrule 0.14.0 iter/MAX_ITER_LOOP. { |
| 107 | self.finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished. = true; |
| 108 | self.was_limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#was_limited. = true; |
| 109 | logrust-analyzer cargo log 0.4.27 crate/::warnrust-analyzer cargo log 0.4.27 macros/warn!!( |
| 110 | "Reached max loop counter (`{}`). \ |
| 111 | See 'validator limits' in docs for more info.", |
| 112 | MAX_ITER_LOOPrust-analyzer cargo rrule 0.14.0 iter/MAX_ITER_LOOP. |
| 113 | ); |
| 114 | return true; |
| 115 | } |
| 116 | } |
| 117 | let rrule = self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..rrulerust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rrule().(); |
| 118 | |
| 119 | let dayset = self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..get_daysetrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_dayset().( |
| 120 | rrule.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq., |
| 121 | self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year., |
| 122 | self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month., |
| 123 | self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day., |
| 124 | ); |
| 125 | |
| 126 | let tz = self.dt_startrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#dt_start..timezonerust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timezone().(); |
| 127 | |
| 128 | if rrule.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 129 | // Loop over `start..end` |
| 130 | for current_day in &dayset { |
| 131 | let current_day = i64::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[i64][`TryFrom<usize>`]try_from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().current_day).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().( |
| 132 | "We control the dayset, and we know that it will always fit within an i64", |
| 133 | ); |
| 134 | let year_ordinal = self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..year_ordinalrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_ordinal().(); |
| 135 | // Ordinal conversion uses UTC: if we apply local-TZ here, then |
| 136 | // just below we'll end up double-applying. |
| 137 | let date = date_from_ordinalrust-analyzer cargo rrule 0.14.0 iter/utils/date_from_ordinal().(year_ordinal rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][`Add<Self>`]add().current_day); |
| 138 | for time in &self.timesetrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#timeset. { |
| 139 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dt) = add_time_to_daterust-analyzer cargo rrule 0.14.0 iter/utils/add_time_to_date().(tz, date, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().time) else { |
| 140 | continue; |
| 141 | }; |
| 142 | if Selfrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]::try_add_datetimerust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]try_add_datetime().( |
| 143 | dt, |
| 144 | rrule, |
| 145 | &mut self.countrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#count., |
| 146 | &mut self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer., |
| 147 | &self.dt_startrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#dt_start., |
| 148 | ) { |
| 149 | return true; |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | } else { |
| 154 | let pos_list = build_pos_listrust-analyzer cargo rrule 0.14.0 iter/pos_list/build_pos_list().( |
| 155 | &rrule.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos., |
| 156 | &dayset, |
| 157 | &self.timesetrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#timeset., |
| 158 | self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..year_ordinalrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]year_ordinal().(), |
| 159 | self.dt_startrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#dt_start..timezonerust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timezone().(), |
| 160 | ); |
| 161 | for dt in pos_list { |
| 162 | if Selfrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]::try_add_datetimerust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]try_add_datetime().( |
| 163 | dt, |
| 164 | rrule, |
| 165 | &mut self.countrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#count., |
| 166 | &mut self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer., |
| 167 | &self.dt_startrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#dt_start., |
| 168 | ) { |
| 169 | return true; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | let increment_day = dayset.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().(); |
| 175 | if self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(rrule, increment_day).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().() { |
| 176 | self.finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished. = true; |
| 177 | return true; |
| 178 | } |
| 179 | |
| 180 | if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 181 | rrule.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq., |
| 182 | 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# |
| 183 | ) { |
| 184 | let hour = |
| 185 | u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour.).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("range 0-23 is covered by u8"); |
| 186 | let minute = |
| 187 | u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute.).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("range 0-59 is covered by u8"); |
| 188 | let second = |
| 189 | u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date..secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second.).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("range 0-59 is covered by u8"); |
| 190 | self.timesetrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#timeset. = self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..get_timeset_uncheckedrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]get_timeset_unchecked().(hour, minute, second); |
| 191 | } |
| 192 | |
| 193 | self.iirust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#ii..rebuildrust-analyzer cargo rrule 0.14.0 iter/iterinfo/impl#[IterInfo]rebuild().(&self.counter_daterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#counter_date.); |
| 194 | } |
| 195 | |
| 196 | // Indicate that there might be more items on the next iteration. |
| 197 | false |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter# { |
| 202 | type Itemrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter][Iterator]Item# = 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#>; |
| 203 | |
| 204 | fn nextrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 205 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]is_empty().() { |
| 206 | return self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer..pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 207 | } |
| 208 | |
| 209 | if self.finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished. { |
| 210 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 211 | } |
| 212 | |
| 213 | self.finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished. = self.generaterust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]generate().(); |
| 214 | |
| 215 | if self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]is_empty().() { |
| 216 | self.finishedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#finished. = true; |
| 217 | } |
| 218 | self.bufferrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#buffer..pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) trait WasLimitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/WasLimited# { |
| 223 | fn was_limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/WasLimited#was_limited().(&self) -> bool; |
| 224 | } |
| 225 | |
| 226 | impl WasLimitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/WasLimited# for RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter# { |
| 227 | fn was_limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter][WasLimited]was_limited().(&self) -> bool { |
| 228 | self.was_limitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#was_limited. |
| 229 | } |
| 230 | } |