| 1 | use chronorust-analyzer cargo chrono 0.4.40 crate/::DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#; |
| 2 | |
| 3 | use superrust-analyzer cargo rrule 0.14.0 iter/::rrule_iterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/::WasLimitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/WasLimited#; |
| 4 | use superrust-analyzer cargo rrule 0.14.0 iter/::{rrule_iterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/::RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#, MAX_ITER_LOOPrust-analyzer cargo rrule 0.14.0 iter/MAX_ITER_LOOP.}; |
| 5 | use craterust-analyzer cargo rrule 0.14.0 crate/::RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#; |
| 6 | use craterust-analyzer cargo rrule 0.14.0 crate/::{RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#, Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#}; |
| 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/::BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 9 | 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/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#}; |
| 10 | |
| 11 | #[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:)] |
| 12 | /// Iterator over all the dates in an [`RRuleSet`]. |
| 13 | pub struct RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter# { |
| 14 | queuerust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#queue.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<usize, DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 15 | limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#limited.: bool, |
| 16 | rrule_itersrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rrule_iters.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#>, |
| 17 | exrulesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exrules.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#>, |
| 18 | exdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exdates.: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<i64>, |
| 19 | /// Sorted additional dates in descending order |
| 20 | rdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rdates.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 21 | was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#was_limited.: bool, |
| 22 | } |
| 23 | |
| 24 | impl RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter# { |
| 25 | fn generate_daterust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]generate_date().( |
| 26 | dates: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 27 | exrules: &mut [RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#], |
| 28 | exdates: &mut BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<i64>, |
| 29 | limited: bool, |
| 30 | ) -> (Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, bool) { |
| 31 | if dates.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 32 | return (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false); |
| 33 | } |
| 34 | |
| 35 | let mut date = dates.removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(dates.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() 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); |
| 36 | let mut loop_counter: u32 = 0; |
| 37 | while Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]::is_date_excludedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]is_date_excluded().(&date, exrules, exdates) { |
| 38 | if dates.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 39 | return (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false); |
| 40 | } |
| 41 | // Prevent infinite loops |
| 42 | if limited { |
| 43 | 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; |
| 44 | 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. { |
| 45 | logrust-analyzer cargo log 0.4.27 crate/::warnrust-analyzer cargo log 0.4.27 macros/warn!!( |
| 46 | "Reached max loop counter (`{}`). \ |
| 47 | See 'validator limits' in docs for more info.", |
| 48 | MAX_ITER_LOOPrust-analyzer cargo rrule 0.14.0 iter/MAX_ITER_LOOP. |
| 49 | ); |
| 50 | return (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true); |
| 51 | } |
| 52 | } |
| 53 | date = dates.removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(dates.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() 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); |
| 54 | } |
| 55 | |
| 56 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(date), false) |
| 57 | } |
| 58 | |
| 59 | fn generaterust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]generate().( |
| 60 | rrule_iter: &mut RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#, |
| 61 | exrules: &mut [RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#], |
| 62 | exdates: &mut BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<i64>, |
| 63 | limited: bool, |
| 64 | ) -> (Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, bool) { |
| 65 | let mut date = match rrule_iter.nextrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter][Iterator]next().() { |
| 66 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) => d, |
| 67 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false), |
| 68 | }; |
| 69 | let mut loop_counter: u32 = 0; |
| 70 | while Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]::is_date_excludedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]is_date_excluded().(&date, exrules, exdates) { |
| 71 | // Prevent infinite loops |
| 72 | if limited { |
| 73 | 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; |
| 74 | 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. { |
| 75 | logrust-analyzer cargo log 0.4.27 crate/::warnrust-analyzer cargo log 0.4.27 macros/warn!!( |
| 76 | "Reached max loop counter (`{}`). \ |
| 77 | See 'validator limits' in docs for more info.", |
| 78 | MAX_ITER_LOOPrust-analyzer cargo rrule 0.14.0 iter/MAX_ITER_LOOP. |
| 79 | ); |
| 80 | return (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | date = match rrule_iter.nextrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter][Iterator]next().() { |
| 85 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) => d, |
| 86 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false), |
| 87 | }; |
| 88 | } |
| 89 | |
| 90 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(date), false) |
| 91 | } |
| 92 | |
| 93 | fn is_date_excludedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]is_date_excluded().( |
| 94 | date: &DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>, |
| 95 | exrules: &mut [RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#], |
| 96 | exdates: &mut BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<i64>, |
| 97 | ) -> bool { |
| 98 | for exrule in exrules { |
| 99 | for exdate in exrule { |
| 100 | exdates.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]insert().(exdate.timestamprust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timestamp().()); |
| 101 | if exdate rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().date { |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | exdates.containsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]contains().(&date.timestamprust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timestamp().()) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter# { |
| 112 | type Itemrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][Iterator]Item# = DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>; |
| 113 | |
| 114 | fn nextrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][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/rruleset_iter/impl#[RRuleSetIter][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 115 | let mut next_date: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(usize, DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>)> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 116 | |
| 117 | // If there already was an error, return the error again. |
| 118 | if self.was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#was_limited. { |
| 119 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 120 | } |
| 121 | |
| 122 | for (i, rrule_iter) in self.rrule_itersrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rrule_iters..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 123 | let rrule_queue = self.queuerust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#queue..removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]remove().(&i); |
| 124 | let next_rrule_date = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) = rrule_queue { |
| 125 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) |
| 126 | } else { |
| 127 | // should be method on self |
| 128 | let (date, was_limited) = Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][Iterator]::generaterust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]generate().( |
| 129 | rrule_iter, |
| 130 | &mut self.exrulesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exrules., |
| 131 | &mut self.exdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exdates., |
| 132 | self.limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#limited., |
| 133 | ); |
| 134 | |
| 135 | if was_limited { |
| 136 | self.was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#was_limited. = true; |
| 137 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 138 | } |
| 139 | |
| 140 | date |
| 141 | }; |
| 142 | |
| 143 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_rrule_date) = next_rrule_date { |
| 144 | match next_date { |
| 145 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => next_date = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((i, next_rrule_date)), |
| 146 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((idx, date)) => { |
| 147 | if date 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().next_rrule_date { |
| 148 | // Add previous date to its rrule queue |
| 149 | self.queuerust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#queue..insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(idx, date); |
| 150 | |
| 151 | // Update next_date |
| 152 | next_date = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((i, next_rrule_date)); |
| 153 | } else { |
| 154 | // Store for next iterations |
| 155 | self.queuerust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#queue..insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(i, next_rrule_date); |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | let (generated_date, was_limited) = Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][Iterator]::generate_daterust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter]generate_date().( |
| 163 | &mut self.rdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rdates., |
| 164 | &mut self.exrulesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exrules., |
| 165 | &mut self.exdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exdates., |
| 166 | self.limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#limited., |
| 167 | ); |
| 168 | if was_limited { |
| 169 | self.was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#was_limited. = true; |
| 170 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 171 | } |
| 172 | |
| 173 | match generated_date { |
| 174 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first_rdate) => { |
| 175 | let next_date = match next_date { |
| 176 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_date) => { |
| 177 | if next_date.1 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().first_rdate { |
| 178 | // Add previous date to its rrule queue |
| 179 | self.queuerust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#queue..insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(next_date.0, next_date.1); |
| 180 | |
| 181 | first_rdate |
| 182 | } else { |
| 183 | // add rdate back |
| 184 | self.rdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rdates..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(first_rdate); |
| 185 | |
| 186 | next_date.1 |
| 187 | } |
| 188 | } |
| 189 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => first_rdate, |
| 190 | }; |
| 191 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_date) |
| 192 | } |
| 193 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => next_date.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|d| d.1), |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | impl IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for &RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet# { |
| 199 | type Itemrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]Item# = DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>; |
| 200 | |
| 201 | type IntoIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]IntoIter# = RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#; |
| 202 | |
| 203 | fn into_iterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { |
| 204 | // Sort in decreasing order |
| 205 | let mut rdates_sorted = self.rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(); |
| 206 | rdates_sorted |
| 207 | .sort_byrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by().(|d1, d2| d2.partial_cmprust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][`PartialOrd<DateTime<Tz2>>`]partial_cmp().(d1).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("Could not order dates correctly")); |
| 208 | |
| 209 | let limited = self.limitedrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#limited.; |
| 210 | |
| 211 | RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter# { |
| 212 | queuerust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#queue.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(), |
| 213 | limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#limited., |
| 214 | rrule_itersrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rrule_iters.: self |
| 215 | .rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule. |
| 216 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 217 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|rrule| rrule.iter_with_ctxrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[RRule]iter_with_ctx().(self.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start., limited)) |
| 218 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 219 | rdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#rdates.: rdates_sorted, |
| 220 | exrulesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exrules.: self |
| 221 | .exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule. |
| 222 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 223 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|exrule| exrule.iter_with_ctxrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[RRule]iter_with_ctx().(self.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start., limited)) |
| 224 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 225 | exdatesrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#exdates.: self.exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#::timestamprust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timestamp().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 226 | was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#was_limited.: false, |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | impl WasLimitedrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/WasLimited# for RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter# { |
| 232 | fn was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][WasLimited]was_limited().(&self) -> bool { |
| 233 | self.was_limitedrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter#was_limited. |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for RRuleSetIterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/RRuleSetIter# { |
| 238 | type Errrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][FromStr]Err# = RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#; |
| 239 | |
| 240 | fn from_strrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][FromStr], Selfrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[RRuleSetIter][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 241 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#::from_strrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]from_str().(s)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_iterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]into_iter().()) |
| 242 | } |
| 243 | } |