Debian Codegraph @

src/iter/counter_date.rs

raw symbols SCIP
1 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/::HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#;
2
3 use chronorust-analyzer cargo chrono 0.4.40 crate/::{Datelikerust-analyzer cargo chrono 0.4.40 traits/Datelike#, TimeZonerust-analyzer cargo chrono 0.4.40 offset/TimeZone#, Timelikerust-analyzer cargo chrono 0.4.40 traits/Timelike#, Utcrust-analyzer cargo chrono 0.4.40 offset/utc/Utc#, Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#};
4
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#, RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#, Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#};
6
7 use superrust-analyzer cargo rrule 0.14.0 iter/::{
8 checksrust-analyzer cargo rrule 0.14.0 iter/checks/,
9 masksrust-analyzer cargo rrule 0.14.0 iter/masks/::MASKSrust-analyzer cargo rrule 0.14.0 iter/masks/MASKS.,
10 operation_errorsrust-analyzer cargo rrule 0.14.0 iter/operation_errors/::{checked_add_u32rust-analyzer cargo rrule 0.14.0 iter/operation_errors/checked_add_u32()., checked_mul_u32rust-analyzer cargo rrule 0.14.0 iter/operation_errors/checked_mul_u32().},
11 utilsrust-analyzer cargo rrule 0.14.0 iter/utils/::is_leap_yearrust-analyzer cargo rrule 0.14.0 iter/utils/is_leap_year().,
12 };
13
14 const MINUTES_IN_A_DAYrust-analyzer cargo rrule 0.14.0 iter/counter_date/MINUTES_IN_A_DAY.: u32 = 60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().24;
15 const SECONDS_IN_A_DAYrust-analyzer cargo rrule 0.14.0 iter/counter_date/SECONDS_IN_A_DAY.: u32 = 60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().24;
16
17 /// A simple date time type used during iteration.
18 #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
19 pub(craterust-analyzer cargo rrule 0.14.0 crate/) struct DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter# {
20 pub yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year.: i32,
21 pub monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month.: u32,
22 pub dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day.: u32,
23 pub hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour.: u32,
24 pub minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute.: u32,
25 pub secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second.: u32,
26 }
27
28 impl DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter# {
29 /// Increments the datetime based on the [`RRule`] values.
30 ///
31 /// If `increment_day` is set to `true`, then the method will also make sure that
32 /// the day is incremented. This is useful is the case where `rrule.freq`
33 /// is higher than daily (e.g. hourly) where this function might return a date with the
34 /// same day, but the iterator already knows that the current day can't
35 /// be part of the result.
36 pub fn incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&mut self, rrule: &RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#, increment_day: bool) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
37 let RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
38 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
39 week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start.,
40 by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour.,
41 by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute.,
42 by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second.,
43 ..
44 } = rrule;
45 match rrule.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. {
46 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly# => self.increment_yearlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_yearly().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval),
47 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly# => self.increment_monthlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_monthly().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval),
48 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly# => self.increment_weeklyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_weekly().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().week_start),
49 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily# => self.increment_dailyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_daily().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval),
50 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# => self.increment_hourlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_hourly().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval, by_hour, increment_day),
51 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# => {
52 self.increment_minutelyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_minutely().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval, by_hour, by_minute, increment_day)
53 }
54 Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# => {
55 self.increment_secondlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_secondly().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().interval, by_hour, by_minute, by_second, increment_day)
56 }
57 }
58 }
59
60 fn increment_yearlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_yearly().(&mut self, interval: u16) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
61 self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<u16>`]from().(interval);
62 checksrust-analyzer cargo rrule 0.14.0 iter/checks/::check_year_rangerust-analyzer cargo rrule 0.14.0 iter/checks/check_year_range().(self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
63 self.fix_dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]fix_day().()
64 }
65
66 fn increment_monthlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_monthly().(&mut self, interval: u16) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
67 self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. 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().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
68 if self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().12 {
69 let mut year_div = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`TryFrom<u32>`]try_from().(self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month.).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| {
70 RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().(
71 "Encountered a too high new month. Please decrease the rrule interval.",
72 )
73 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().12;
74 self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().%=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().12;
75 if self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. 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 {
76 self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. = 12;
77 year_div rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign().1;
78 }
79 self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<u16>`]from().(year_div);
80 checksrust-analyzer cargo rrule 0.14.0 iter/checks/::check_year_rangerust-analyzer cargo rrule 0.14.0 iter/checks/check_year_range().(self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
81 }
82 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
83 }
84
85 fn get_weekdayrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]get_weekday().(&self) -> u32 {
86 let month_range_mask = if is_leap_yearrust-analyzer cargo rrule 0.14.0 iter/utils/is_leap_year().(self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year.) {
87 &MASKSrust-analyzer cargo rrule 0.14.0 iter/masks/MASKS..month_366_rangerust-analyzer cargo rrule 0.14.0 iter/masks/Masks#month_366_range.
88 } else {
89 &MASKSrust-analyzer cargo rrule 0.14.0 iter/masks/MASKS..month_365_rangerust-analyzer cargo rrule 0.14.0 iter/masks/Masks#month_365_range.
90 };
91 let year_day = u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(month_range_mask[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. as usize 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().) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1;
92 let year_day_mod = year_day rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().7;
93 let year_start_weekday = Utcrust-analyzer cargo chrono 0.4.40 offset/utc/Utc#
94 .with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year., 1, 1, 0, 0, 0)
95 // It should never fail, since there is always a 1st of January, is there?
96 .unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().()
97 .weekdayrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]weekday().()
98 .num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().();
99
100 (year_day_mod rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().year_start_weekday) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().7
101 }
102
103 fn increment_weeklyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_weekly().(&mut self, interval: u16, week_start: Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
104 let weekday = self.get_weekdayrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]get_weekday().();
105 let option_week_start = week_start.num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().();
106 let interval = u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
107 // Calculate the amount of day to move forward.
108 let day_delta = if option_week_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().weekday {
109 // `weekday` and `option_week_start` can only be in range `0..=6`
110 // `option_week_start` > `weekday` so:
111 // `(weekday + 1 + 6 - option_week_start)` > 0 so can never be negative.
112 interval rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().(weekday rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().option_week_start)
113 } else {
114 // This can also never be negative
115 interval rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().(weekday rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().option_week_start)
116 };
117 self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. 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().day_delta;
118 self.fix_dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]fix_day().()
119 }
120
121 fn days_in_monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]days_in_month().(&self) -> u32 {
122 if self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. 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 {
123 31
124 } else {
125 let month_range_mask = if is_leap_yearrust-analyzer cargo rrule 0.14.0 iter/utils/is_leap_year().(self.yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year.) {
126 &MASKSrust-analyzer cargo rrule 0.14.0 iter/masks/MASKS..month_366_rangerust-analyzer cargo rrule 0.14.0 iter/masks/Masks#month_366_range.
127 } else {
128 &MASKSrust-analyzer cargo rrule 0.14.0 iter/masks/MASKS..month_365_rangerust-analyzer cargo rrule 0.14.0 iter/masks/Masks#month_365_range.
129 };
130 let days_in_month =
131 month_range_mask[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. as usize]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 ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().month_range_mask[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month. as usize 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().;
132 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(days_in_month)
133 }
134 }
135
136 fn fix_dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]fix_day().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
137 if self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().28 {
138 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
139 }
140
141 let mut days_in_month = self.days_in_monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]days_in_month().();
142 if self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().days_in_month {
143 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
144 }
145
146 while self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().days_in_month {
147 self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. 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().days_in_month;
148 self.increment_monthlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_monthly().(1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
149
150 days_in_month = self.days_in_monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]days_in_month().();
151 }
152 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
153 }
154
155 fn increment_dailyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_daily().(&mut self, interval: u16) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
156 self.dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day. 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().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
157 self.fix_dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]fix_day().()
158 }
159
160 fn increment_hourlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_hourly().(
161 &mut self,
162 interval: u16,
163 by_hour: &[u8],
164 increment_day: bool,
165 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
166 if increment_day {
167 // Jump to one iteration before the next day
168 let temp_value = (23 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
169 self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. 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().checked_mul_u32rust-analyzer cargo rrule 0.14.0 iter/operation_errors/checked_mul_u32().(
170 temp_value,
171 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval),
172 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("please decrease `INTERVAL`"),
173 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
174 }
175
176 let mut prev_hours = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().();
177 loop {
178 self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. = checked_add_u32rust-analyzer cargo rrule 0.14.0 iter/operation_errors/checked_add_u32().(
179 self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour.,
180 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval),
181 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("please decrease `INTERVAL`"),
182 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
183 let new_hours = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().24).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");
184 if by_hour.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() || by_hour.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|bh| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().bh rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().new_hours) {
185 break;
186 }
187 if prev_hours.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&new_hours) {
188 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().(
189 "Infinite loop detected. It can be resolved by changing `BYHOUR` or `INTERVAL`",
190 ));
191 }
192 prev_hours.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(new_hours);
193 }
194
195 let new_days = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`TryFrom<u32>`]try_from().(self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().24).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| {
196 RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().("unexpected high hour, please decrease the interval")
197 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
198 self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().%=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().24;
199 if new_days rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 {
200 self.increment_dailyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_daily().(new_days)
201 } else {
202 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
203 }
204 }
205
206 fn increment_minutelyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_minutely().(
207 &mut self,
208 interval: u16,
209 by_hour: &[u8],
210 by_minute: &[u8],
211 increment_day: bool,
212 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
213 if increment_day {
214 // Jump to one iteration before the next day
215 let minutes_total = self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute.;
216 let temp_value = (MINUTES_IN_A_DAYrust-analyzer cargo rrule 0.14.0 iter/counter_date/MINUTES_IN_A_DAY. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().minutes_total) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
217 self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. 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().checked_mul_u32rust-analyzer cargo rrule 0.14.0 iter/operation_errors/checked_mul_u32().(
218 temp_value,
219 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval),
220 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("please decrease `INTERVAL`"),
221 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
222 }
223
224 let mut prev_values = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().();
225 loop {
226 self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. 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().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
227 let hours_div = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`TryFrom<u32>`]try_from().(self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().60).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| {
228 RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().("unexpected high minute, please decrease interval")
229 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
230 if hours_div rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 {
231 self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().%=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().60;
232 self.increment_hourlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_hourly().(hours_div, by_hour, increment_day)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
233 }
234
235 let hours = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().24).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");
236 let minutes = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60).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");
237
238 if (by_hour.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() || by_hour.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&hours))
239 && (by_minute.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() || by_minute.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&minutes))
240 {
241 break;
242 }
243
244 if prev_values.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&(hours, minutes)) {
245 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().(
246 "Infinite loop detected. It can be resolved by changing `BYMINUTE`, `BYHOUR` or `INTERVAL`",
247 ));
248 }
249 prev_values.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().((hours, minutes));
250 }
251
252 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
253 }
254
255 fn increment_secondlyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_secondly().(
256 &mut self,
257 interval: u16,
258 by_hour: &[u8],
259 by_minute: &[u8],
260 by_second: &[u8],
261 increment_day: bool,
262 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> {
263 if increment_day {
264 // Jump to one iteration before the next day
265 let total_seconds = self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().3600 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().self.secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second.;
266 let temp_value = (SECONDS_IN_A_DAYrust-analyzer cargo rrule 0.14.0 iter/counter_date/SECONDS_IN_A_DAY. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().total_seconds) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
267 self.secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second. 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().checked_mul_u32rust-analyzer cargo rrule 0.14.0 iter/operation_errors/checked_mul_u32().(
268 temp_value,
269 u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval),
270 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("please decrease `INTERVAL`"),
271 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
272 }
273
274 let mut prev_values = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().();
275 loop {
276 self.secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second. 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().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u16>`]from().(interval);
277 let minutes_div = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`TryFrom<u32>`]try_from().(self.secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().60).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| {
278 RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().("unexpected high second, please decrease interval")
279 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
280 if minutes_div rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 {
281 self.secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().%=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`RemAssign<Self>`]rem_assign().60;
282 self.increment_minutelyrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment_minutely().(minutes_div, by_hour, by_minute, increment_day)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
283 }
284
285 let hours = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().24).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");
286 let minutes = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60).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");
287 let seconds = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(self.secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60).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");
288
289 if (by_hour.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() || by_hour.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&hours))
290 && (by_minute.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() || by_minute.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&minutes))
291 && (by_second.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() || by_second.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&seconds))
292 {
293 break;
294 }
295
296 if prev_values.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&(hours, minutes, seconds)) {
297 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#::new_iter_errrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError]new_iter_err().(
298 "Infinite loop detected. It can be resolved by changing `BYSECOND`, `BYMINUTE`, `BYHOUR` or `INTERVAL`",
299 ));
300 }
301 prev_values.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().((hours, minutes, seconds));
302 }
303
304 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
305 }
306 }
307
308 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&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#>> for DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter# {
309 fn fromrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter][`From<&chrono::DateTime<Tz>>`]from().(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#>) -> Selfrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter][`From<&chrono::DateTime<Tz>>`] {
310 Selfrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter][`From<&chrono::DateTime<Tz>>`] {
311 yearrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#year.: dt.yearrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]year().(),
312 monthrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#month.: dt.monthrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]month().(),
313 dayrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#day.: dt.dayrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]day().(),
314 hourrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#hour.: dt.hourrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Timelike]hour().(),
315 minuterust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#minute.: dt.minuterust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Timelike]minute().(),
316 secondrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#second.: dt.secondrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Timelike]second().(),
317 }
318 }
319 }
320
321 #[cfg(test)]
322 mod testsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ {
323 use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#;
324
325 use superrust-analyzer cargo rrule 0.14.0 iter/counter_date/::*;
326 use chronorust-analyzer cargo chrono 0.4.40 crate/::TimeZonerust-analyzer cargo chrono 0.4.40 offset/TimeZone#;
327
328 const UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC.: Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz# = Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#::UTCrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]UTC.;
329
330 fn ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32) -> DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter# {
331 let dt = UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC.
332 .with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(year, month, day, hour, min, sec)
333 .unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().();
334 DateTimeIterrust-analyzer cargo rrule 0.14.0 iter/counter_date/DateTimeIter#::fromrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter][`From<&chrono::DateTime<Tz>>`]from().(&dt)
335 }
336
337 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
338 fn increments_counter_date_with_yearly_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_yearly_freq().() {
339 let tests = [
340 (
341 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
342 1,
343 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1998, 1, 1, 0, 0, 0),
344 ),
345 (
346 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(2020, 2, 29, 0, 0, 0),
347 1,
348 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(2021, 3, 1, 0, 0, 0),
349 ),
350 (
351 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
352 3,
353 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(2000, 1, 1, 0, 0, 0),
354 ),
355 (
356 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
357 20,
358 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(2017, 1, 1, 0, 0, 0),
359 ),
360 ];
361 for (mut counter_date, interval, expected_output) in tests {
362 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
363 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
364 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly#,
365 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
366 }
367 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
368 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
369
370 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
371 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
372 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
373 }
374 }
375
376 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
377 fn increments_counter_date_with_monthly_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_monthly_freq().() {
378 let tests = [
379 (
380 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
381 1,
382 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 2, 1, 0, 0, 0),
383 ),
384 (
385 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
386 11,
387 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 12, 1, 0, 0, 0),
388 ),
389 (
390 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
391 12,
392 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1998, 1, 1, 0, 0, 0),
393 ),
394 (
395 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 12, 1, 0, 0, 0),
396 1,
397 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1998, 1, 1, 0, 0, 0),
398 ),
399 (
400 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 11, 1, 0, 0, 0),
401 12 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().10,
402 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(2007, 11, 1, 0, 0, 0),
403 ),
404 ];
405 for (mut counter_date, interval, expected_output) in tests {
406 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
407 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
408 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly#,
409 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
410 }
411 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
412 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
413
414 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
415 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
416 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
417 }
418 }
419
420 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
421 fn increments_counter_date_with_weekly_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_weekly_freq().() {
422 let tests = [
423 (
424 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
425 1,
426 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 6, 0, 0, 0),
427 ),
428 (
429 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
430 2,
431 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 13, 0, 0, 0),
432 ),
433 (
434 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
435 5,
436 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 2, 3, 0, 0, 0),
437 ),
438 (
439 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
440 52,
441 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 12, 29, 0, 0, 0),
442 ),
443 (
444 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
445 53,
446 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1998, 1, 5, 0, 0, 0),
447 ),
448 ];
449 for (mut counter_date, interval, expected_output) in tests {
450 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
451 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
452 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly#,
453 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
454 }
455 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
456 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
457
458 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
459 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
460 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
461 }
462 }
463
464 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
465 fn increments_counter_date_with_daily_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_daily_freq().() {
466 let tests = [
467 (
468 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
469 1,
470 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
471 ),
472 (
473 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
474 2,
475 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 3, 0, 0, 0),
476 ),
477 (
478 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
479 31,
480 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 2, 1, 0, 0, 0),
481 ),
482 (
483 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
484 365,
485 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1998, 1, 1, 0, 0, 0),
486 ),
487 ];
488 for (mut counter_date, interval, expected_output) in tests {
489 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
490 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
491 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily#,
492 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
493 }
494 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
495 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
496
497 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
498 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
499 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
500 }
501 }
502
503 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
504 fn increments_counter_date_with_hourly_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_hourly_freq().() {
505 let tests = [
506 (
507 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
508 1,
509 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
510 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 1, 0, 0),
511 ),
512 (
513 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
514 2,
515 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
516 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 2, 0, 0),
517 ),
518 (
519 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
520 1,
521 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![4],
522 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 4, 0, 0),
523 ),
524 (
525 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 10, 0, 0),
526 1,
527 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![4, 14],
528 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 14, 0, 0),
529 ),
530 (
531 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
532 24,
533 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
534 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
535 ),
536 (
537 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
538 24 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().31,
539 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
540 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 2, 1, 0, 0, 0),
541 ),
542 ];
543 for (mut counter_date, interval, by_hour, expected_output) in tests {
544 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
545 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
546 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly#,
547 by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour.,
548 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
549 }
550 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
551 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
552
553 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
554 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
555 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
556 }
557 }
558
559 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
560 fn increments_counter_date_with_hourly_freq_and_day_incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_hourly_freq_and_day_increment().() {
561 let tests = [
562 (
563 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
564 1,
565 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
566 ),
567 (
568 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
569 2,
570 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
571 ),
572 (
573 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
574 5,
575 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 1, 0, 0),
576 ),
577 (
578 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
579 24,
580 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
581 ),
582 (
583 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
584 24 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().31,
585 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 2, 1, 0, 0, 0),
586 ),
587 (
588 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
589 24 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().31 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().1,
590 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 2, 1, 1, 0, 0),
591 ),
592 ];
593 for (mut counter_date, interval, expected_output) in tests {
594 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
595 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
596 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly#,
597 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
598 }
599 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
600 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
601
602 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, true);
603 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
604 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
605 }
606 }
607
608 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
609 fn increments_counter_date_with_minutely_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_minutely_freq().() {
610 let tests = [
611 (
612 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
613 1,
614 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 1, 0),
615 ),
616 (
617 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
618 2,
619 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 2, 0),
620 ),
621 (
622 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
623 60,
624 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 1, 0, 0),
625 ),
626 (
627 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
628 60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().24,
629 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
630 ),
631 ];
632 for (mut counter_date, interval, expected_output) in tests {
633 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
634 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
635 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely#,
636 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
637 }
638 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
639 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
640
641 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
642 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
643 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
644 }
645 }
646
647 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
648 fn increments_counter_date_with_minutely_freq_and_day_incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_minutely_freq_and_day_increment().() {
649 let tests = [
650 (
651 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
652 1,
653 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
654 ),
655 (
656 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
657 2,
658 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
659 ),
660 (
661 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
662 60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().24 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().1,
663 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 1, 0),
664 ),
665 ];
666 for (mut counter_date, interval, expected_output) in tests {
667 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
668 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
669 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely#,
670 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
671 }
672 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
673 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
674
675 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, true);
676 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
677 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
678 }
679 }
680
681 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
682 fn increments_counter_date_with_secondly_freqrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_secondly_freq().() {
683 let tests = [
684 (
685 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
686 1,
687 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 1),
688 ),
689 (
690 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
691 2,
692 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 2),
693 ),
694 (
695 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
696 60,
697 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 1, 0),
698 ),
699 (
700 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
701 60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().60,
702 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 1, 0, 0),
703 ),
704 ];
705 for (mut counter_date, interval, expected_output) in tests {
706 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
707 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
708 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly#,
709 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
710 }
711 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
712 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
713
714 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, false);
715 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
716 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
717 }
718 }
719
720 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
721 fn increments_counter_date_with_secondly_freq_and_day_incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/increments_counter_date_with_secondly_freq_and_day_increment().() {
722 let tests = [
723 (
724 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
725 1,
726 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
727 ),
728 (
729 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
730 2,
731 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 0, 0),
732 ),
733 (
734 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 1, 0, 0, 0),
735 60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().24 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().1,
736 ymd_hmsrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/ymd_hms().(1997, 1, 2, 0, 1, 0),
737 ),
738 ];
739 for (mut counter_date, interval, expected_output) in tests {
740 let rrule = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# {
741 intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.,
742 freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly#,
743 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().()
744 }
745 .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(UTCrust-analyzer cargo rrule 0.14.0 iter/counter_date/tests/UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 1, 1, 1).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().())
746 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
747
748 let res = counter_date.incrementrust-analyzer cargo rrule 0.14.0 iter/counter_date/impl#[DateTimeIter]increment().(&rrule, true);
749 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(res.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().());
750 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(counter_date, expected_output);
751 }
752 }
753 }