| 1 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::datetimerust-analyzer cargo rrule 0.14.0 core/datetime/::datetime_to_ical_formatrust-analyzer cargo rrule 0.14.0 core/datetime/datetime_to_ical_format().; |
| 2 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::utilsrust-analyzer cargo rrule 0.14.0 core/utils/::collect_with_errorrust-analyzer cargo rrule 0.14.0 core/utils/collect_with_error().; |
| 3 | use craterust-analyzer cargo rrule 0.14.0 crate/::parserrust-analyzer cargo rrule 0.14.0 parser/::{ContentLinerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#, Grammarrust-analyzer cargo rrule 0.14.0 parser/Grammar#}; |
| 4 | use craterust-analyzer cargo rrule 0.14.0 crate/::{ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#, 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#}; |
| 5 | use chronorust-analyzer cargo chrono 0.4.40 crate/::DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#; |
| 6 | #[cfg(feature = "serde")] |
| 7 | use serde_withrust-analyzer cargo serde_with 3.12.0 crate/::{serde_asrust-analyzer cargo serde_with_macros 3.12.0 serde_as:, DeserializeFromStrrust-analyzer cargo serde_with_macros 3.12.0 DeserializeFromStr:, SerializeDisplayrust-analyzer cargo serde_with_macros 3.12.0 SerializeDisplay:}; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#; |
| 9 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 10 | |
| 11 | /// A validated Recurrence Rule that can be used to create an iterator. |
| 12 | #[cfg_attr(feature = "serde", serde_as)] |
| 13 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 14 | #[cfg_attr(feature = "serde", deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(DeserializeFromStrrust-analyzer cargo serde_with_macros 3.12.0 DeserializeFromStr:, SerializeDisplayrust-analyzer cargo serde_with_macros 3.12.0 SerializeDisplay:))] |
| 15 | pub struct RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet# { |
| 16 | /// List of rrules. |
| 17 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#>, |
| 18 | /// List of rdates. |
| 19 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 20 | /// List of exules. |
| 21 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#>, |
| 22 | /// List of exdates. |
| 23 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 24 | /// The start datetime of the recurring event. |
| 25 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start.: DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>, |
| 26 | /// If set, all returned recurrences must be before this date. |
| 27 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) beforerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#before.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 28 | /// If set, all returned recurrences must be after this date. |
| 29 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) afterrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#after.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 30 | /// If validation limits are enabled |
| 31 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) limitedrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#limited.: bool, |
| 32 | } |
| 33 | |
| 34 | /// The return result of `RRuleSet::all`. |
| 35 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 36 | pub struct RRuleResultrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult# { |
| 37 | /// List of recurrences. |
| 38 | pub datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>, |
| 39 | /// It is being true if the list of dates is limited. |
| 40 | /// To indicate that it can potentially contain more dates. |
| 41 | pub limitedrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#limited.: bool, |
| 42 | } |
| 43 | |
| 44 | impl RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet# { |
| 45 | /// Creates an empty [`RRuleSet`], starting from `ds_start`. |
| 46 | #[must_use] |
| 47 | pub fn newrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]new().(dt_start: 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 core/rruleset/impl#[RRuleSet] { |
| 48 | Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 49 | dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start., |
| 50 | rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 51 | rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 52 | exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 53 | exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 54 | beforerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#before.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 55 | afterrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#after.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 56 | limitedrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#limited.: false, |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /// Enable validation limits. |
| 61 | /// |
| 62 | /// This is only needed if you are going to use the Iterator api directly. |
| 63 | #[must_use] |
| 64 | pub fn limitrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]limit().(mut self) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 65 | self.limitedrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#limited. = true; |
| 66 | self |
| 67 | } |
| 68 | |
| 69 | /// Only return recurrences that comes before this `DateTime`. |
| 70 | /// |
| 71 | /// This value will not be used if you use the `Iterator` API directly. |
| 72 | #[must_use] |
| 73 | pub fn beforerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]before().(mut self, dt: 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 core/rruleset/impl#[RRuleSet] { |
| 74 | self.beforerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#before. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dt); |
| 75 | self |
| 76 | } |
| 77 | |
| 78 | /// Only return recurrences that comes after this `DateTime`. |
| 79 | /// |
| 80 | /// This value will not be used if you use the `Iterator` API directly. |
| 81 | #[must_use] |
| 82 | pub fn afterrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]after().(mut self, dt: 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 core/rruleset/impl#[RRuleSet] { |
| 83 | self.afterrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#after. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dt); |
| 84 | self |
| 85 | } |
| 86 | |
| 87 | /// Adds a new rrule to the set. |
| 88 | #[must_use] |
| 89 | pub fn rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]rrule().(mut self, rrule: RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 90 | self.rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(rrule); |
| 91 | self |
| 92 | } |
| 93 | |
| 94 | /// Adds a new exrule to the set. |
| 95 | #[must_use] |
| 96 | #[cfg(feature = "exrule")] |
| 97 | pub fn exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]exrule().(mut self, rrule: RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 98 | self.exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(rrule); |
| 99 | self |
| 100 | } |
| 101 | |
| 102 | /// Adds a new rdate to the set. |
| 103 | #[must_use] |
| 104 | pub fn rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]rdate().(mut self, rdate: 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 core/rruleset/impl#[RRuleSet] { |
| 105 | self.rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(rdate); |
| 106 | self |
| 107 | } |
| 108 | |
| 109 | /// Adds a new exdate to the set. |
| 110 | #[must_use] |
| 111 | pub fn exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]exdate().(mut self, exdate: 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 core/rruleset/impl#[RRuleSet] { |
| 112 | self.exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(exdate); |
| 113 | self |
| 114 | } |
| 115 | |
| 116 | /// Sets the rrules of the set. |
| 117 | #[must_use] |
| 118 | pub fn set_rrulesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_rrules().(mut self, rrules: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 119 | self.rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule. = rrules; |
| 120 | self |
| 121 | } |
| 122 | |
| 123 | /// Sets the exrules of the set. |
| 124 | #[must_use] |
| 125 | #[cfg(feature = "exrule")] |
| 126 | pub fn set_exrulesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_exrules().(mut self, exrules: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 127 | self.exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule. = exrules; |
| 128 | self |
| 129 | } |
| 130 | |
| 131 | /// Sets the rdates of the set. |
| 132 | #[must_use] |
| 133 | pub fn set_rdatesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_rdates().(mut self, rdates: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 134 | self.rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate. = rdates; |
| 135 | self |
| 136 | } |
| 137 | |
| 138 | /// Set the exdates of the set. |
| 139 | #[must_use] |
| 140 | pub fn set_exdatesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_exdates().(mut self, exdates: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet] { |
| 141 | self.exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate. = exdates; |
| 142 | self |
| 143 | } |
| 144 | |
| 145 | /// Returns the rrules of the set. |
| 146 | #[must_use] |
| 147 | pub fn get_rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]get_rrule().(&self) -> &Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#> { |
| 148 | &self.rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule. |
| 149 | } |
| 150 | |
| 151 | /// Returns the exrules of the set. |
| 152 | #[must_use] |
| 153 | pub fn get_exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]get_exrule().(&self) -> &Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#> { |
| 154 | &self.exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule. |
| 155 | } |
| 156 | |
| 157 | /// Returns the rdates of the set. |
| 158 | #[must_use] |
| 159 | pub fn get_rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]get_rdate().(&self) -> &Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>> { |
| 160 | &self.rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate. |
| 161 | } |
| 162 | |
| 163 | /// Returns the exdates of the set. |
| 164 | #[must_use] |
| 165 | pub fn get_exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]get_exdate().(&self) -> &Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>> { |
| 166 | &self.exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate. |
| 167 | } |
| 168 | |
| 169 | /// Returns the start datetime of the recurring event. |
| 170 | #[must_use] |
| 171 | pub fn get_dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]get_dt_start().(&self) -> &DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#> { |
| 172 | &self.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start. |
| 173 | } |
| 174 | |
| 175 | /// Returns all the recurrences of the rrule. |
| 176 | /// |
| 177 | /// Limit must be set in order to prevent infinite loops. |
| 178 | /// The max limit is `65535`. If you need more please use `into_iter` directly. |
| 179 | /// |
| 180 | /// # Usage |
| 181 | /// |
| 182 | /// ``` |
| 183 | /// use rrule::RRuleSet; |
| 184 | /// |
| 185 | /// let rrule_set: RRuleSet = "DTSTART:20210101T090000Z\nRRULE:FREQ=DAILY".parse().unwrap(); |
| 186 | /// |
| 187 | /// // Limit the results to 2 recurrences |
| 188 | /// let result = rrule_set.all(2); |
| 189 | /// assert_eq!(result.dates.len(), 2); |
| 190 | /// assert_eq!(result.limited, true); |
| 191 | /// ``` |
| 192 | #[must_use] |
| 193 | pub fn allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(mut self, limit: u16) -> RRuleResultrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult# { |
| 194 | self.limitedrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#limited. = true; |
| 195 | collect_with_errorrust-analyzer cargo rrule 0.14.0 core/utils/collect_with_error().( |
| 196 | self.into_iterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]into_iter().(), |
| 197 | &self.afterrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#after., |
| 198 | &self.beforerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#before., |
| 199 | true, |
| 200 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(limit), |
| 201 | ) |
| 202 | } |
| 203 | |
| 204 | /// Returns all the recurrences of the rrule. |
| 205 | /// |
| 206 | /// # Note |
| 207 | /// |
| 208 | /// This method does not enforce any validation limits and might lead to |
| 209 | /// very long iteration times. Please read the `SECURITY.md` for more information. |
| 210 | #[must_use] |
| 211 | pub fn all_uncheckedrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all_unchecked().(self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>> { |
| 212 | collect_with_errorrust-analyzer cargo rrule 0.14.0 core/utils/collect_with_error().(self.into_iterrust-analyzer cargo rrule 0.14.0 iter/rruleset_iter/impl#[`&RRuleSet`][IntoIterator]into_iter().(), &self.afterrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#after., &self.beforerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#before., true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates. |
| 213 | } |
| 214 | |
| 215 | fn set_from_content_linesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_from_content_lines().(self, content_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ContentLinerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet], RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> { |
| 216 | let dt_start = self.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start.; |
| 217 | |
| 218 | content_lines.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().try_foldrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]try_fold().( |
| 219 | self, |
| 220 | |rrule_set, content_line| match content_line { |
| 221 | ContentLinerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#::RRulerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#RRule#(rrule) => rrule |
| 222 | .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(dt_start) |
| 223 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|rrule| rrule_set.rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]rrule().(rrule)), |
| 224 | #[allow(unused_variables)] |
| 225 | ContentLinerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#::ExRulerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#ExRule#(exrule) => { |
| 226 | #[cfg(feature = "exrule")] |
| 227 | { |
| 228 | exrule |
| 229 | .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(dt_start) |
| 230 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|exrule| rrule_set.exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]exrule().(exrule)) |
| 231 | } |
| 232 | #[cfg(not(feature = "exrule"))] |
| 233 | { |
| 234 | logrust-analyzer cargo log 0.4.27 crate/::warnrust-analyzer cargo log 0.4.27 macros/warn!!("Found EXRULE in input, but it will be ignored since the `exrule` feature is not enabled."); |
| 235 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rrule_set) |
| 236 | } |
| 237 | } |
| 238 | ContentLinerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#::ExDaterust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#ExDate#(exdates) => { |
| 239 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(exdates.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().foldrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]fold().(rrule_set, Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]::exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]exdate().)) |
| 240 | } |
| 241 | ContentLinerust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#::RDaterust-analyzer cargo rrule 0.14.0 parser/content_line/ContentLine#RDate#(rdates) => { |
| 242 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rdates.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().foldrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]fold().(rrule_set, Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]::rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]rdate().)) |
| 243 | } |
| 244 | }, |
| 245 | ) |
| 246 | } |
| 247 | |
| 248 | /// Set the [`RRuleSet`] properties from a string. If a DTSTART is found, it will be used as the start datetime. |
| 249 | pub fn set_from_stringrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_from_string().(mut self, s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet], RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> { |
| 250 | let Grammarrust-analyzer cargo rrule 0.14.0 parser/Grammar# { |
| 251 | startrust-analyzer cargo rrule 0.14.0 parser/Grammar#start., |
| 252 | content_linesrust-analyzer cargo rrule 0.14.0 parser/Grammar#content_lines., |
| 253 | } = Grammarrust-analyzer cargo rrule 0.14.0 parser/Grammar#::from_strrust-analyzer cargo rrule 0.14.0 parser/impl#[Grammar][FromStr]from_str().(s)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 254 | |
| 255 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dtstart) = start { |
| 256 | self.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start. = dtstart.datetimerust-analyzer cargo rrule 0.14.0 parser/content_line/start_date_content_line/StartDateContentLine#datetime.; |
| 257 | } |
| 258 | |
| 259 | self.set_from_content_linesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_from_content_lines().(content_lines) |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet# { |
| 264 | type Errrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]Err# = RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#; |
| 265 | |
| 266 | /// Creates an [`RRuleSet`] from a string if input is valid. |
| 267 | /// |
| 268 | /// # Errors |
| 269 | /// |
| 270 | /// Returns [`RRuleError`], if iCalendar string contains invalid parts. |
| 271 | fn from_strrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr], Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 272 | let Grammarrust-analyzer cargo rrule 0.14.0 parser/Grammar# { |
| 273 | startrust-analyzer cargo rrule 0.14.0 parser/Grammar#start., |
| 274 | content_linesrust-analyzer cargo rrule 0.14.0 parser/Grammar#content_lines., |
| 275 | } = Grammarrust-analyzer cargo rrule 0.14.0 parser/Grammar#::from_strrust-analyzer cargo rrule 0.14.0 parser/impl#[Grammar][FromStr]from_str().(s)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 276 | |
| 277 | let start = start.ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::MissingStartDaterust-analyzer cargo rrule 0.14.0 parser/error/ParseError#MissingStartDate#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 278 | |
| 279 | Selfrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]::newrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]new().(start.datetimerust-analyzer cargo rrule 0.14.0 parser/content_line/start_date_content_line/StartDateContentLine#datetime.).set_from_content_linesrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]set_from_content_lines().(content_lines) |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet# { |
| 284 | /// Prints a valid set of iCalendar properties which can be used to create a new [`RRuleSet`] later. |
| 285 | /// You may use the generated string to create a new iCalendar component, like VEVENT. |
| 286 | fn fmtrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][Display]fmt().(&self, f: &mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 287 | let start_datetime = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("DTSTART{}", datetime_to_ical_formatrust-analyzer cargo rrule 0.14.0 core/datetime/datetime_to_ical_format().(&self.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start.)); |
| 288 | |
| 289 | let mut rrules = self |
| 290 | .rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule. |
| 291 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 292 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|rrule| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("RRULE:{rrule}")) |
| 293 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 294 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("\n"); |
| 295 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rrules.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() { |
| 296 | rrules = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("\n{rrules}"); |
| 297 | } |
| 298 | |
| 299 | let mut rdates = self |
| 300 | .rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate. |
| 301 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 302 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|dt| { |
| 303 | let maybe_zulu = if dt.timezonerust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timezone().().is_localrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]is_local().() { "" } else { "Z" }; |
| 304 | |
| 305 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}{}", dt.formatrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]format().("%Y%m%dT%H%M%S"), maybe_zulu) |
| 306 | }) |
| 307 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 308 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(","); |
| 309 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rdates.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() { |
| 310 | // TODO: check if original VALUE prop was DATE or PERIOD |
| 311 | rdates = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("\nRDATE;VALUE=DATE-TIME:{rdates}"); |
| 312 | } |
| 313 | |
| 314 | let mut exrules = self |
| 315 | .exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule. |
| 316 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 317 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|exrule| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("EXRULE:{exrule}")) |
| 318 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 319 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("\n"); |
| 320 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().exrules.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() { |
| 321 | exrules = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("\n{exrules}"); |
| 322 | } |
| 323 | |
| 324 | let mut exdates = self |
| 325 | .exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate. |
| 326 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 327 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|dt| { |
| 328 | let maybe_zulu = if dt.timezonerust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]timezone().().is_localrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]is_local().() { "" } else { "Z" }; |
| 329 | |
| 330 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}{}", dt.formatrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]format().("%Y%m%dT%H%M%S"), maybe_zulu) |
| 331 | }) |
| 332 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 333 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(","); |
| 334 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().exdates.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() { |
| 335 | // TODO: check if original VALUE prop was DATE or PERIOD |
| 336 | exdates = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("\nEXDATE;VALUE=DATE-TIME:{exdates}"); |
| 337 | } |
| 338 | |
| 339 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{start_datetime}{rrules}{rdates}{exrules}{exdates}") |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | #[cfg(feature = "exrule")] |
| 344 | #[cfg(test)] |
| 345 | mod testsrust-analyzer cargo rrule 0.14.0 core/rruleset/tests/ { |
| 346 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 347 | |
| 348 | use chronorust-analyzer cargo chrono 0.4.40 crate/::{Monthrust-analyzer cargo chrono 0.4.40 month/Month#, TimeZonerust-analyzer cargo chrono 0.4.40 offset/TimeZone#}; |
| 349 | |
| 350 | 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#, RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#, Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#}; |
| 351 | |
| 352 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 353 | fn rruleset_string_roundtriprust-analyzer cargo rrule 0.14.0 core/rruleset/tests/rruleset_string_roundtrip().() { |
| 354 | let rruleset_str = "DTSTART:20120201T093000Z\nRRULE:FREQ=DAILY;COUNT=3;BYHOUR=9;BYMINUTE=30;BYSECOND=0\nRDATE;VALUE=DATE-TIME:19970101T000000Z,19970120T000000Z\nEXRULE:FREQ=YEARLY;COUNT=8;BYMONTH=6,7;BYMONTHDAY=1;BYHOUR=9;BYMINUTE=30;BYSECOND=0\nEXDATE;VALUE=DATE-TIME:19970121T000000Z"; |
| 355 | let rruleset = RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#::from_strrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]from_str().(rruleset_str).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 356 | |
| 357 | // Check start date |
| 358 | let dt_start = Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#::UTCrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(2012, 2, 1, 9, 30, 0).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().(); |
| 359 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rruleset.dt_startrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#dt_start., dt_start); |
| 360 | |
| 361 | // Check rrule |
| 362 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 363 | rruleset.rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rrule., |
| 364 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#::newrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]new().(Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily#) |
| 365 | .countrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]count().(3) |
| 366 | .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(dt_start) |
| 367 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()] |
| 368 | ); |
| 369 | |
| 370 | // Check rdate |
| 371 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 372 | rruleset.rdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#rdate., |
| 373 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 374 | Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#::UTCrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 1, 0, 0, 0).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().(), |
| 375 | Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#::UTCrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 20, 0, 0, 0).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().() |
| 376 | ] |
| 377 | ); |
| 378 | |
| 379 | // Check exrule |
| 380 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 381 | rruleset.exrulerust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exrule., |
| 382 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#::newrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]new().(Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly#) |
| 383 | .countrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]count().(8) |
| 384 | .by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_month().(&[Monthrust-analyzer cargo chrono 0.4.40 month/Month#::Junerust-analyzer cargo chrono 0.4.40 month/Month#June#, Monthrust-analyzer cargo chrono 0.4.40 month/Month#::Julyrust-analyzer cargo chrono 0.4.40 month/Month#July#]) |
| 385 | .validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(dt_start) |
| 386 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()] |
| 387 | ); |
| 388 | |
| 389 | // Check exdate |
| 390 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 391 | rruleset.exdaterust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#exdate., |
| 392 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#::UTCrust-analyzer cargo rrule 0.14.0 core/timezone/impl#[Tz]UTC..with_ymd_and_hmsrust-analyzer cargo chrono 0.4.40 offset/TimeZone#with_ymd_and_hms().(1997, 1, 21, 0, 0, 0).unwraprust-analyzer cargo chrono 0.4.40 offset/impl#[`LocalResult<T>`]unwrap().()] |
| 393 | ); |
| 394 | |
| 395 | // Serialize to string again |
| 396 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rruleset.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), rruleset_str); |
| 397 | } |
| 398 | |
| 399 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 400 | fn respect_local_timezone_in_exdates_rdatesrust-analyzer cargo rrule 0.14.0 core/rruleset/tests/respect_local_timezone_in_exdates_rdates().() { |
| 401 | let rruleset_str = "DTSTART:20120201T093000Z\nRRULE:FREQ=DAILY;COUNT=3;BYHOUR=9;BYMINUTE=30;BYSECOND=0\nRDATE;VALUE=DATE-TIME:19970101T000000,19970120T000000\nEXRULE:FREQ=YEARLY;COUNT=8;BYMONTH=6,7;BYMONTHDAY=1;BYHOUR=9;BYMINUTE=30;BYSECOND=0\nEXDATE;VALUE=DATE-TIME:19970121T000000"; |
| 402 | let rruleset = RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#::from_strrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]from_str().(rruleset_str).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 403 | |
| 404 | // Serialize to string again |
| 405 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rruleset.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), rruleset_str); |
| 406 | } |
| 407 | |
| 408 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 409 | fn respect_utc_timezone_in_exdates_rdatesrust-analyzer cargo rrule 0.14.0 core/rruleset/tests/respect_utc_timezone_in_exdates_rdates().() { |
| 410 | let rruleset_str = "DTSTART:20120201T093000Z\nRRULE:FREQ=DAILY;COUNT=3;BYHOUR=9;BYMINUTE=30;BYSECOND=0\nRDATE;VALUE=DATE-TIME:19970101T000000Z,19970120T000000Z\nEXRULE:FREQ=YEARLY;COUNT=8;BYMONTH=6,7;BYMONTHDAY=1;BYHOUR=9;BYMINUTE=30;BYSECOND=0\nEXDATE;VALUE=DATE-TIME:19970121T000000Z"; |
| 411 | let rruleset = RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#::from_strrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet][FromStr]from_str().(rruleset_str).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 412 | |
| 413 | // Serialize to string again |
| 414 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rruleset.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), rruleset_str); |
| 415 | } |
| 416 | } |