| 1 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::get_dayrust-analyzer cargo rrule 0.14.0 core/datetime/get_day().; |
| 2 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::get_hourrust-analyzer cargo rrule 0.14.0 core/datetime/get_hour().; |
| 3 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::get_minuterust-analyzer cargo rrule 0.14.0 core/datetime/get_minute().; |
| 4 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::get_monthrust-analyzer cargo rrule 0.14.0 core/datetime/get_month().; |
| 5 | use craterust-analyzer cargo rrule 0.14.0 crate/::corerust-analyzer cargo rrule 0.14.0 core/::get_secondrust-analyzer cargo rrule 0.14.0 core/datetime/get_second().; |
| 6 | use craterust-analyzer cargo rrule 0.14.0 crate/::iterrust-analyzer cargo rrule 0.14.0 iter/::RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#; |
| 7 | use craterust-analyzer cargo rrule 0.14.0 crate/::parserrust-analyzer cargo rrule 0.14.0 parser/::str_to_weekdayrust-analyzer cargo rrule 0.14.0 parser/datetime/str_to_weekday().; |
| 8 | use craterust-analyzer cargo rrule 0.14.0 crate/::parserrust-analyzer cargo rrule 0.14.0 parser/::ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#; |
| 9 | use craterust-analyzer cargo rrule 0.14.0 crate/::parserrust-analyzer cargo rrule 0.14.0 parser/::ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#; |
| 10 | use craterust-analyzer cargo rrule 0.14.0 crate/::validatorrust-analyzer cargo rrule 0.14.0 validator/::validate_rrulerust-analyzer cargo rrule 0.14.0 validator/validate_rrule/; |
| 11 | use craterust-analyzer cargo rrule 0.14.0 crate/::validatorrust-analyzer cargo rrule 0.14.0 validator/::ValidationErrorrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#; |
| 12 | use craterust-analyzer cargo rrule 0.14.0 crate/::Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#; |
| 13 | use craterust-analyzer cargo rrule 0.14.0 crate/::{RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#, RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#, Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#, Validatedrust-analyzer cargo rrule 0.14.0 core/Validated#}; |
| 14 | use chronorust-analyzer cargo chrono 0.4.40 crate/::DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#; |
| 15 | use chronorust-analyzer cargo chrono 0.4.40 crate/::{Datelikerust-analyzer cargo chrono 0.4.40 traits/Datelike#, Monthrust-analyzer cargo chrono 0.4.40 month/Month#, Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#}; |
| 16 | #[cfg(feature = "serde")] |
| 17 | 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:}; |
| 18 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#; |
| 19 | 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#; |
| 20 | 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/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#; |
| 21 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 22 | 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#; |
| 23 | |
| 24 | #[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:, 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:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 25 | #[cfg_attr(feature = "serde", derive(DeserializeFromStrrust-analyzer cargo serde_with_macros 3.12.0 DeserializeFromStr:, SerializeDisplayrust-analyzer cargo serde_with_macros 3.12.0 SerializeDisplay:))] |
| 26 | /// The frequency of a recurrence. |
| 27 | pub enum Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency# { |
| 28 | /// The recurrence occurs on a yearly basis. |
| 29 | Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly# = 0, |
| 30 | /// The recurrence occurs on a monthly basis. |
| 31 | Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly# = 1, |
| 32 | /// The recurrence occurs on a weekly basis. |
| 33 | Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly# = 2, |
| 34 | /// The recurrence occurs on a daily basis. |
| 35 | Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily# = 3, |
| 36 | /// The recurrence occurs on an hourly basis. |
| 37 | Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# = 4, |
| 38 | /// The recurrence occurs on a minutely basis. |
| 39 | Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# = 5, |
| 40 | /// The recurrence occurs on a second basis. |
| 41 | Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# = 6, |
| 42 | } |
| 43 | |
| 44 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency# { |
| 45 | fn fmtrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]fmt().(&self, f: &mut 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# { |
| 46 | let name = match self { |
| 47 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly# => "YEARLY", |
| 48 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly# => "MONTHLY", |
| 49 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly# => "WEEKLY", |
| 50 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily# => "DAILY", |
| 51 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# => "HOURLY", |
| 52 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# => "MINUTELY", |
| 53 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][Display]::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# => "SECONDLY", |
| 54 | }; |
| 55 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", name) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency# { |
| 60 | type Errrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]Err# = ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#; |
| 61 | |
| 62 | fn from_strrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]from_str().(value: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr], Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 63 | let freq = match &value.to_uppercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_uppercase().()[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index(). { |
| 64 | "YEARLY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly#, |
| 65 | "MONTHLY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly#, |
| 66 | "WEEKLY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly#, |
| 67 | "DAILY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily#, |
| 68 | "HOURLY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly#, |
| 69 | "MINUTELY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely#, |
| 70 | "SECONDLY" => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly#, |
| 71 | val => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidFrequencyrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidFrequency#(val.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 72 | }; |
| 73 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(freq) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | /// This indicates the nth occurrence of a specific day within a MONTHLY or YEARLY RRULE. |
| 78 | /// |
| 79 | /// For example, `NWeekday::Nth(1, MO)` represents the first Monday within the month or year, |
| 80 | /// whereas `NWeekday::Nth(-1, MO)` represents the last Monday of the month or year. |
| 81 | /// And `NWeekday::Every(MO)`, means all Mondays of the month or year. |
| 82 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, 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:)] |
| 83 | #[cfg_attr(feature = "serde", derive(DeserializeFromStrrust-analyzer cargo serde_with_macros 3.12.0 DeserializeFromStr:, SerializeDisplayrust-analyzer cargo serde_with_macros 3.12.0 SerializeDisplay:))] |
| 84 | pub enum NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday# { |
| 85 | /// When it is every weekday of the month or year. |
| 86 | Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#), |
| 87 | /// When it is the nth weekday of the month or year. |
| 88 | /// The first member's value is from -366 to -1 and 1 to 366 depending on frequency |
| 89 | Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(i16, Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#), |
| 90 | } |
| 91 | |
| 92 | // The ordering here doesn't really matter as it is only used to sort for display purposes |
| 93 | fn n_weekday_cmprust-analyzer cargo rrule 0.14.0 core/rrule/n_weekday_cmp().(val1: NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#, val2: NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 94 | match val1 { |
| 95 | NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(wday) => match val2 { |
| 96 | NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(other_wday) => wday |
| 97 | .num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().() |
| 98 | .cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][Ord]cmp().(&other_wday.num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().()), |
| 99 | NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(_n, _other_wday) => Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Lessrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Less#, |
| 100 | }, |
| 101 | NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(n, wday) => match val2 { |
| 102 | NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(_) => Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Greaterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Greater#, |
| 103 | NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(other_n, other_wday) => match n.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][Ord]cmp().(&other_n) { |
| 104 | Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal# => wday |
| 105 | .num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().() |
| 106 | .cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][Ord]cmp().(&other_wday.num_days_from_mondayrust-analyzer cargo chrono 0.4.40 weekday/impl#[Weekday]num_days_from_monday().()), |
| 107 | less_or_greater => less_or_greater, |
| 108 | }, |
| 109 | }, |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | impl PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday# { |
| 114 | fn partial_cmprust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> { |
| 115 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.cmprust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][Ord]cmp().(other)) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | impl Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday# { |
| 120 | fn cmprust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][Ord]cmp().(&self, other: &Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][Ord]) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 121 | n_weekday_cmprust-analyzer cargo rrule 0.14.0 core/rrule/n_weekday_cmp().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().other) |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | impl NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday# { |
| 126 | /// Creates a new week occurrence |
| 127 | /// |
| 128 | /// # Arguments |
| 129 | /// |
| 130 | /// * `n` - The nth occurrence of the week day. Should be between -366 and 366, and not 0. |
| 131 | /// * `weekday` - The week day |
| 132 | /// |
| 133 | /// # Example |
| 134 | /// |
| 135 | /// ``` |
| 136 | /// use chrono::Weekday; |
| 137 | /// use rrule::NWeekday; |
| 138 | /// |
| 139 | /// let nth_weekday = NWeekday::new(Some(1), Weekday::Mon); |
| 140 | /// ``` |
| 141 | #[must_use] |
| 142 | pub fn newrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday]new().(number: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<i16>, weekday: Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday] { |
| 143 | match number { |
| 144 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(number) => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday]::Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(number, weekday), |
| 145 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday]::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(weekday), |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday# { |
| 151 | type Errrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][FromStr]Err# = ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#; |
| 152 | |
| 153 | /// Generates an [`NWeekday`] from a string. |
| 154 | fn from_strrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][FromStr]from_str().(value: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][FromStr], Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 155 | let length = value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(); |
| 156 | |
| 157 | if length rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().2 { |
| 158 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidWeekdayrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidWeekday#(value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 159 | } |
| 160 | |
| 161 | // it doesn't have any issue, because we checked the string is ASCII above |
| 162 | let wd = str_to_weekdayrust-analyzer cargo rrule 0.14.0 parser/datetime/str_to_weekday().(&value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().(length 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().2)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) |
| 163 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidWeekdayrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidWeekday#(value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 164 | let nth = value[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/range/RangeTo#(length 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().2)]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i16>().unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_default().(); |
| 165 | |
| 166 | if nth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialEq<Self>`]eq().0 { |
| 167 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][FromStr]::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(wd)) |
| 168 | } else { |
| 169 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][FromStr]::newrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday]new().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(nth), wd)) |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday# { |
| 175 | /// Returns a string representation of the [`NWeekday`] |
| 176 | /// |
| 177 | /// ``` |
| 178 | /// use chrono::Weekday; |
| 179 | /// use rrule::NWeekday; |
| 180 | /// |
| 181 | /// assert_eq!(format!("{}", NWeekday::Every(Weekday::Mon)), "MO"); |
| 182 | /// assert_eq!(format!("{}", NWeekday::Nth(1, Weekday::Mon)), "MO"); |
| 183 | /// assert_eq!(format!("{}", NWeekday::Nth(2, Weekday::Mon)), "2MO"); |
| 184 | /// ``` |
| 185 | fn fmtrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][Display]fmt().(&self, f: &mut 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# { |
| 186 | let weekday = match self { |
| 187 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][Display]::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(wd) => weekday_to_strrust-analyzer cargo rrule 0.14.0 core/rrule/weekday_to_str().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().wd), |
| 188 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[NWeekday][Display]::Nthrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Nth#(number, wd) => { |
| 189 | let mut wd_str = weekday_to_strrust-analyzer cargo rrule 0.14.0 core/rrule/weekday_to_str().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().wd); |
| 190 | if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialEq<Self>`]ne().1 { |
| 191 | wd_str = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}{}", number, wd_str); |
| 192 | }; |
| 193 | wd_str |
| 194 | } |
| 195 | }; |
| 196 | |
| 197 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", weekday) |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | fn weekday_to_strrust-analyzer cargo rrule 0.14.0 core/rrule/weekday_to_str().(d: Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 202 | match d { |
| 203 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Monrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Mon# => "MO".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 204 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Tuerust-analyzer cargo chrono 0.4.40 weekday/Weekday#Tue# => "TU".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 205 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Wedrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Wed# => "WE".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 206 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Thurust-analyzer cargo chrono 0.4.40 weekday/Weekday#Thu# => "TH".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 207 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Frirust-analyzer cargo chrono 0.4.40 weekday/Weekday#Fri# => "FR".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 208 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Satrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Sat# => "SA".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 209 | Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Sunrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Sun# => "SU".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /// Represents a complete RRULE property based on the [iCalendar specification](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.5.3) |
| 214 | /// It has two stages, based on the attached type, `Validated` or `Unvalidated`. |
| 215 | /// - `Unvalidated`, which is the raw string representation of the RRULE |
| 216 | /// - `Validated`, which is when the `RRule` has been parsed and validated, based on the start date |
| 217 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debug, Clone, PartialEq, Eq)] |
| 218 | #[cfg_attr(feature = "serde", serde_as)] |
| 219 | #[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:))] |
| 220 | pub struct RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Stage = Validatedrust-analyzer cargo rrule 0.14.0 core/Validated#> { |
| 221 | /// The frequency of the rrule. |
| 222 | /// For example, yearly, weekly, hourly |
| 223 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#, |
| 224 | /// The interval between each frequency iteration. |
| 225 | /// For example, |
| 226 | /// - A yearly frequency with an interval of `2` creates 1 event every two years. |
| 227 | /// - An hourly frequency with an interval of `2` created 1 event every two hours. |
| 228 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.: u16, |
| 229 | /// How many occurrences will be generated. |
| 230 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>, |
| 231 | /// The end date after which new events will no longer be generated. |
| 232 | /// If the `DateTime` is equal to an instance of the event, it will be the last event. |
| 233 | #[cfg_attr(feature = "serde", serde_as(as = "DisplayFromStr"))] |
| 234 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until.: 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#>>, |
| 235 | /// The start day of the week. |
| 236 | /// This will affect recurrences based on weekly periods. |
| 237 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start.: Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#, |
| 238 | /// Occurrence number corresponding to the frequency period. |
| 239 | /// For example: |
| 240 | /// - A monthly frequency with an `by_set_pos` of `-1` meaning the last day of the month. |
| 241 | /// - An hourly frequency with an `by_set_pos` of `2` meaning the 2nd hour. (TODO Check) |
| 242 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>, |
| 243 | /// The months to apply the recurrence to. |
| 244 | /// Can be a value from 1 to 12. |
| 245 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, |
| 246 | /// The month days to apply the recurrence to. |
| 247 | /// Can be a value from -31 to -1 and 1 to 31. |
| 248 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>, |
| 249 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>, |
| 250 | /// The year days to apply the recurrence to. |
| 251 | /// Can be a value from -366 to -1 and 1 to 366. |
| 252 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i16>, |
| 253 | /// The week numbers to apply the recurrence to. |
| 254 | /// Week numbers have the meaning described in ISO8601, that is, |
| 255 | /// the first week of the year is that it contains at least four days of the new year. |
| 256 | /// Week day starts counting on from `week_start` value. |
| 257 | /// Can be a value from -53 to -1 and 1 to 53. |
| 258 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>, |
| 259 | /// The days of the week the rules should be recurring. |
| 260 | /// Should be a value of `Weekday` and optionally with a prefix of -366 to 366 depending on frequency. |
| 261 | /// Corresponds with `BYDAY` field. |
| 262 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#>, |
| 263 | /// The hours to apply the recurrence to. |
| 264 | /// Can be a value from 0 to 23. |
| 265 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, |
| 266 | /// The minutes to apply the recurrence to. |
| 267 | /// Can be a value from 0 to 59. |
| 268 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, |
| 269 | /// The seconds to apply the recurrence to. |
| 270 | /// Can be a value from 0 to 59. |
| 271 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, |
| 272 | /// Extension, not part of RFC spec. |
| 273 | /// Amount of days/months from Easter Sunday itself. |
| 274 | /// Can be a value from -366 to 366. |
| 275 | /// Note: Only used when `by-easter` feature flag is set. Otherwise, it is ignored. |
| 276 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<i16>, |
| 277 | /// A phantom data to have the stage (unvalidated or validated). |
| 278 | #[cfg_attr(feature = "serde", serde_as(as = "ignore"))] |
| 279 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) stagerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#stage.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Stage>, |
| 280 | } |
| 281 | |
| 282 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#> { |
| 283 | /// Creates a new unvalidated `RRule` with default values and Yearly frequency. |
| 284 | fn defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().() -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default] { |
| 285 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default] { |
| 286 | 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#, |
| 287 | intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.: 1, |
| 288 | countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 289 | untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 290 | week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start.: Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Monrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Mon#, |
| 291 | by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 292 | by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 293 | by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 294 | by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 295 | by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 296 | by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 297 | by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 298 | by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 299 | by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 300 | by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 301 | by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 302 | stagerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#stage.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | impl RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#> { |
| 308 | /// Creates a new unvalidated `RRule` with default values and the given frequency. |
| 309 | #[must_use] |
| 310 | pub fn newrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]new().(freq: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 311 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 312 | freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq., |
| 313 | ..Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().() |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | /// The FREQ rule part identifies the type of recurrence rule. |
| 318 | #[must_use] |
| 319 | pub fn freqrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]freq().(mut self, freq: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 320 | self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. = freq; |
| 321 | self |
| 322 | } |
| 323 | |
| 324 | /// The interval between each freq iteration. |
| 325 | #[must_use] |
| 326 | pub fn intervalrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]interval().(mut self, interval: u16) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 327 | self.intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval. = interval; |
| 328 | self |
| 329 | } |
| 330 | |
| 331 | /// If given, this determines how many occurrences will be generated. |
| 332 | #[must_use] |
| 333 | pub fn countrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]count().(mut self, count: u32) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 334 | self.countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(count); |
| 335 | self |
| 336 | } |
| 337 | |
| 338 | /// If given, this must be a datetime instance specifying the |
| 339 | /// upper-bound limit of the recurrence. |
| 340 | #[must_use] |
| 341 | pub fn untilrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]until().(mut self, until: 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/rrule/impl#[`RRule<Unvalidated>`] { |
| 342 | self.untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(until); |
| 343 | self |
| 344 | } |
| 345 | |
| 346 | /// The week start day. This will affect recurrences based on weekly periods. |
| 347 | /// The default week start is [`Weekday::Mon`]. |
| 348 | #[must_use] |
| 349 | pub fn week_startrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]week_start().(mut self, week_start: Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 350 | self.week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start. = week_start; |
| 351 | self |
| 352 | } |
| 353 | |
| 354 | /// If given, it must be either an integer, or a sequence of integers, positive or negative. |
| 355 | /// Each given integer will specify an occurrence number, corresponding to the nth occurrence |
| 356 | /// of the rule inside the frequency period. For example, a `by_set_pos` of -1 if combined with |
| 357 | /// a MONTHLY frequency, and a `by_weekday` of (MO, TU, WE, TH, FR), will result in the last |
| 358 | /// work day of every month. |
| 359 | #[must_use] |
| 360 | pub fn by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_set_pos().(mut self, by_set_pos: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 361 | self.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos. = by_set_pos; |
| 362 | self |
| 363 | } |
| 364 | |
| 365 | /// When given, these variables will define the months to apply the recurrence to. |
| 366 | #[must_use] |
| 367 | pub fn by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_month().(mut self, by_month: &[Monthrust-analyzer cargo chrono 0.4.40 month/Month#]) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 368 | self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month. = by_month |
| 369 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 370 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|month| { |
| 371 | u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u32>`]try_from().(month.number_from_monthrust-analyzer cargo chrono 0.4.40 month/impl#[Month]number_from_month().()).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("1-12 is within range of u8") |
| 372 | }) |
| 373 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 374 | self |
| 375 | } |
| 376 | |
| 377 | /// If given, it must be either an integer, or a sequence of integers, meaning |
| 378 | /// the month days to apply the recurrence to. |
| 379 | #[must_use] |
| 380 | pub fn by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_month_day().(mut self, by_month_day: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 381 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. = by_month_day; |
| 382 | self |
| 383 | } |
| 384 | |
| 385 | /// If given, it must be either an integer, or a sequence of integers, meaning |
| 386 | /// the year days to apply the recurrence to. |
| 387 | #[must_use] |
| 388 | pub fn by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_year_day().(mut self, by_year_day: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i16>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 389 | self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day. = by_year_day; |
| 390 | self |
| 391 | } |
| 392 | |
| 393 | /// If given, it must be either an integer, or a sequence of integers, meaning |
| 394 | /// the week numbers to apply the recurrence to. Week numbers have the meaning |
| 395 | /// described in ISO8601, that is, the first week of the year is that it contains |
| 396 | /// at least four days of the new year. |
| 397 | #[must_use] |
| 398 | pub fn by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_week_no().(mut self, by_week_no: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i8>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 399 | self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no. = by_week_no; |
| 400 | self |
| 401 | } |
| 402 | |
| 403 | /// When given, these variables will define the weekdays where the recurrence |
| 404 | /// will be applied. |
| 405 | #[must_use] |
| 406 | pub fn by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_weekday().(mut self, by_weekday: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 407 | self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday. = by_weekday; |
| 408 | self |
| 409 | } |
| 410 | |
| 411 | /// If given, it must be either an integer, or a sequence of integers, |
| 412 | /// meaning the hours to apply the recurrence to. |
| 413 | #[must_use] |
| 414 | pub fn by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_hour().(mut self, by_hour: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 415 | self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour. = by_hour; |
| 416 | self |
| 417 | } |
| 418 | |
| 419 | /// If given, it must be either an integer, or a sequence of integers, |
| 420 | /// meaning the minutes to apply the recurrence to. |
| 421 | #[must_use] |
| 422 | pub fn by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_minute().(mut self, by_minute: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 423 | self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute. = by_minute; |
| 424 | self |
| 425 | } |
| 426 | |
| 427 | /// If given, it must be either an integer, or a sequence of integers, |
| 428 | /// meaning the seconds to apply the recurrence to. |
| 429 | #[must_use] |
| 430 | pub fn by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_second().(mut self, by_second: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 431 | self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second. = by_second; |
| 432 | self |
| 433 | } |
| 434 | |
| 435 | /// If given, it must be either an integer, or a sequence of integers, positive or negative. |
| 436 | /// Each integer will define an offset from the Easter Sunday. Passing the offset 0 to |
| 437 | /// `by_easter` will yield the Easter Sunday itself. This is an extension to the RFC specification. |
| 438 | #[cfg(feature = "by-easter")] |
| 439 | #[must_use] |
| 440 | pub fn by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]by_easter().(mut self, by_easter: i16) -> Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`] { |
| 441 | self.by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(by_easter); |
| 442 | self |
| 443 | } |
| 444 | |
| 445 | /// Fills in some additional fields in order to make iter work correctly. |
| 446 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) fn finalize_parsed_rrulerust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]finalize_parsed_rrule().(mut self, 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/rrule/impl#[`RRule<Unvalidated>`] { |
| 447 | // TEMP: move negative months to another list |
| 448 | let mut by_month_day = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 449 | let mut by_n_month_day = self.by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day.; |
| 450 | for by_month_day_item in self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. { |
| 451 | match by_month_day_item.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][Ord]cmp().(&0) { |
| 452 | Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Greaterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Greater# => by_month_day.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(by_month_day_item), |
| 453 | Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Lessrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Less# => by_n_month_day.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(by_month_day_item), |
| 454 | Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal# => {} |
| 455 | } |
| 456 | } |
| 457 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. = by_month_day; |
| 458 | self.by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day. = by_n_month_day; |
| 459 | |
| 460 | // Can only be set to true if the feature flag is set. |
| 461 | let by_easter_is_some = if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(feature = "by-easter") { |
| 462 | self.by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() |
| 463 | } else { |
| 464 | false |
| 465 | }; |
| 466 | |
| 467 | // Add some freq-specific additional properties |
| 468 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 469 | || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 470 | || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 471 | || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 472 | || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 473 | || by_easter_is_some) |
| 474 | { |
| 475 | match self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. { |
| 476 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Yearlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Yearly# => { |
| 477 | if self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 478 | let month = get_monthrust-analyzer cargo rrule 0.14.0 core/datetime/get_month().(dt_start); |
| 479 | self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![month]; |
| 480 | } |
| 481 | let day = get_dayrust-analyzer cargo rrule 0.14.0 core/datetime/get_day().(dt_start); |
| 482 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![day]; |
| 483 | } |
| 484 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Monthlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Monthly# => { |
| 485 | let day = get_dayrust-analyzer cargo rrule 0.14.0 core/datetime/get_day().(dt_start); |
| 486 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![day]; |
| 487 | } |
| 488 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Weeklyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Weekly# => { |
| 489 | self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#::Everyrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#Every#(dt_start.weekdayrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`][Datelike]weekday().())]; |
| 490 | } |
| 491 | _ => (), |
| 492 | }; |
| 493 | } |
| 494 | |
| 495 | // by_hour |
| 496 | if self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() && self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# { |
| 497 | let hour = get_hourrust-analyzer cargo rrule 0.14.0 core/datetime/get_hour().(dt_start); |
| 498 | self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![hour]; |
| 499 | } |
| 500 | |
| 501 | // by_minute |
| 502 | if self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() && self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# { |
| 503 | let minute = get_minuterust-analyzer cargo rrule 0.14.0 core/datetime/get_minute().(dt_start); |
| 504 | self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![minute]; |
| 505 | } |
| 506 | |
| 507 | // by_second |
| 508 | if self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() && self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# { |
| 509 | let second = get_secondrust-analyzer cargo rrule 0.14.0 core/datetime/get_second().(dt_start); |
| 510 | self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![second]; |
| 511 | } |
| 512 | |
| 513 | // make sure all BYXXX are unique and sorted |
| 514 | self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 515 | self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 516 | |
| 517 | self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 518 | self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 519 | |
| 520 | self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 521 | self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 522 | |
| 523 | self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 524 | self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 525 | |
| 526 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 527 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 528 | |
| 529 | self.by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 530 | self.by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 531 | |
| 532 | self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 533 | self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 534 | |
| 535 | self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 536 | self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 537 | |
| 538 | self.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 539 | self.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 540 | |
| 541 | self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday..sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().(); |
| 542 | self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday..deduprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]dedup().(); |
| 543 | |
| 544 | self |
| 545 | } |
| 546 | |
| 547 | /// Validates the [`RRule`] with the given `dt_start`. |
| 548 | /// |
| 549 | /// # Errors |
| 550 | /// |
| 551 | /// If the properties aren't valid, it will return [`RRuleError`]. |
| 552 | pub fn validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(self, dt_start: DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Validatedrust-analyzer cargo rrule 0.14.0 core/Validated#>, RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> { |
| 553 | let rrule = self.finalize_parsed_rrulerust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]finalize_parsed_rrule().(&dt_start); |
| 554 | |
| 555 | // Validate required checks (defined by RFC 5545) |
| 556 | validate_rrulerust-analyzer cargo rrule 0.14.0 validator/validate_rrule/::validate_rrule_forcedrust-analyzer cargo rrule 0.14.0 validator/validate_rrule/validate_rrule_forced().(&rrule, &dt_start)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 557 | |
| 558 | // Check if it is possible to generate a timeset |
| 559 | match rrule.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. { |
| 560 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Hourlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Hourly# => { |
| 561 | if rrule.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() && rrule.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 562 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#::UnableToGenerateTimesetrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#UnableToGenerateTimeset#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 563 | } |
| 564 | } |
| 565 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Minutelyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Minutely# => { |
| 566 | if rrule.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 567 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#::UnableToGenerateTimesetrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#UnableToGenerateTimeset#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 568 | } |
| 569 | } |
| 570 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Secondlyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Secondly# => {} |
| 571 | _ => { |
| 572 | if rrule.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 573 | && rrule.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 574 | && rrule.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 575 | { |
| 576 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#::UnableToGenerateTimesetrust-analyzer cargo rrule 0.14.0 validator/error/ValidationError#UnableToGenerateTimeset#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# { |
| 582 | freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: rrule.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq., |
| 583 | intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.: rrule.intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval., |
| 584 | countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count.: rrule.countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count., |
| 585 | untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until.: rrule.untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until., |
| 586 | week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start.: rrule.week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start., |
| 587 | by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos.: rrule.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos., |
| 588 | by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month.: rrule.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month., |
| 589 | by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day.: rrule.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day., |
| 590 | by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day.: rrule.by_n_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_n_month_day., |
| 591 | by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day.: rrule.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day., |
| 592 | by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no.: rrule.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no., |
| 593 | by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday.: rrule.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday., |
| 594 | by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour.: rrule.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour., |
| 595 | by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute.: rrule.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute., |
| 596 | by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second.: rrule.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second., |
| 597 | by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter.: rrule.by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter., |
| 598 | stagerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#stage.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 599 | }) |
| 600 | } |
| 601 | |
| 602 | /// Validates the [`RRule`] with the given `dt_start` and creates an [`RRuleSet`] struct. |
| 603 | /// |
| 604 | /// # Errors |
| 605 | /// |
| 606 | /// Returns [`RRuleError::ValidationError`] in case the rrule is invalid. |
| 607 | pub fn buildrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]build().(self, dt_start: DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#, RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#> { |
| 608 | let rrule = self.validaterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`]validate().(dt_start)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 609 | let rrule_set = RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#::newrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]new().(dt_start).rrulerust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]rrule().(rrule); |
| 610 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rrule_set) |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | impl RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# { |
| 615 | pub(craterust-analyzer cargo rrule 0.14.0 crate/) fn iter_with_ctxrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[RRule]iter_with_ctx().(&self, dt_start: DateTimerust-analyzer cargo chrono 0.4.40 datetime/DateTime#<Tzrust-analyzer cargo rrule 0.14.0 core/timezone/Tz#>, limited: bool) -> RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter# { |
| 616 | RRuleIterrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/RRuleIter#::newrust-analyzer cargo rrule 0.14.0 iter/rrule_iter/impl#[RRuleIter]new().(self, &dt_start, limited) |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#> { |
| 621 | type Errrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][FromStr]Err# = RRuleErrorrust-analyzer cargo rrule 0.14.0 error/RRuleError#; |
| 622 | |
| 623 | fn from_strrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][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/rrule/impl#[`RRule<Unvalidated>`][FromStr], Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 624 | let parts = ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#::newrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/impl#[`ContentLineCaptures<'a>`]new().(s)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 625 | Selfrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][FromStr]::try_fromrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`]try_from().(parts).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#::fromrust-analyzer cargo rrule 0.14.0 error/impl#[RRuleError][`From<ParseError>`]from().) |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | impl<S> Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<S> { |
| 630 | /// Generates a string based on the [iCalendar RRULE spec](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.5.3). |
| 631 | /// It doesn't prepend "RRULE:" to the string. |
| 632 | /// When you call this function on [`RRule<Unvalidated>`], it can generate an invalid string, like 'FREQ=YEARLY;INTERVAL=-1' |
| 633 | /// But it is supposed to always generate a valid string on [`RRule<Validated>`]. |
| 634 | /// So if you want a valid string, it's smarter to always use `rrule.validate(ds_start)?.to_string()`. |
| 635 | #[allow(clippy::too_many_lines)] |
| 636 | fn fmtrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`][Display]fmt().(&self, f: &mut 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# { |
| 637 | let mut res = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(15); |
| 638 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("FREQ={}", &self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.)); |
| 639 | |
| 640 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(until) = &self.untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until. { |
| 641 | let maybe_zulu = if until.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" }; |
| 642 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 643 | "UNTIL={}{}", |
| 644 | until.formatrust-analyzer cargo chrono 0.4.40 datetime/impl#[`DateTime<Tz>`]format().("%Y%m%dT%H%M%S"), |
| 645 | maybe_zulu |
| 646 | )); |
| 647 | } |
| 648 | |
| 649 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(count) = &self.countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count. { |
| 650 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("COUNT={}", count)); |
| 651 | } |
| 652 | |
| 653 | // One interval is the default, no need to expose it. |
| 654 | if self.intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().1 { |
| 655 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("INTERVAL={}", &self.intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval.)); |
| 656 | } |
| 657 | |
| 658 | // Monday is the default, no need to expose it. |
| 659 | if self.week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Monrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Mon# { |
| 660 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("WKST={}", weekday_to_strrust-analyzer cargo rrule 0.14.0 core/rrule/weekday_to_str().(self.week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start.))); |
| 661 | } |
| 662 | |
| 663 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 664 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 665 | "BYSETPOS={}", |
| 666 | self.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos. |
| 667 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 668 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 669 | .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#<_>>() |
| 670 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 671 | )); |
| 672 | } |
| 673 | |
| 674 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 675 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 676 | "BYMONTH={}", |
| 677 | self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month. |
| 678 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 679 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 680 | .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#<_>>() |
| 681 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 682 | )); |
| 683 | } |
| 684 | |
| 685 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 686 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 687 | "BYMONTHDAY={}", |
| 688 | self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. |
| 689 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 690 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 691 | .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#<_>>() |
| 692 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 693 | )); |
| 694 | } |
| 695 | |
| 696 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 697 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 698 | "BYWEEKNO={}", |
| 699 | self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no. |
| 700 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 701 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 702 | .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#<_>>() |
| 703 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 704 | )); |
| 705 | } |
| 706 | |
| 707 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 708 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 709 | "BYHOUR={}", |
| 710 | self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour. |
| 711 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 712 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 713 | .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#<_>>() |
| 714 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 715 | )); |
| 716 | } |
| 717 | |
| 718 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 719 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 720 | "BYMINUTE={}", |
| 721 | self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute. |
| 722 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 723 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 724 | .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#<_>>() |
| 725 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 726 | )); |
| 727 | } |
| 728 | |
| 729 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 730 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 731 | "BYSECOND={}", |
| 732 | self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second. |
| 733 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 734 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 735 | .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#<_>>() |
| 736 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 737 | )); |
| 738 | } |
| 739 | |
| 740 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 741 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 742 | "BYYEARDAY={}", |
| 743 | self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day. |
| 744 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 745 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 746 | .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#<_>>() |
| 747 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 748 | )); |
| 749 | } |
| 750 | |
| 751 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 752 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 753 | "BYDAY={}", |
| 754 | self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday. |
| 755 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 756 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().) |
| 757 | .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#<_>>() |
| 758 | .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(",") |
| 759 | )); |
| 760 | } |
| 761 | |
| 762 | #[cfg(feature = "by-easter")] |
| 763 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(by_easter) = &self.by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter. { |
| 764 | res.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("BYEASTER={}", by_easter)); |
| 765 | } |
| 766 | |
| 767 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", res.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(";")) |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | impl<S> RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<S> { |
| 772 | /// Get the frequency of the recurrence. |
| 773 | #[must_use] |
| 774 | pub fn get_freqrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_freq().(&self) -> Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency# { |
| 775 | self.freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq. |
| 776 | } |
| 777 | |
| 778 | /// Get the interval of the recurrence. |
| 779 | #[must_use] |
| 780 | pub fn get_intervalrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_interval().(&self) -> u16 { |
| 781 | self.intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval. |
| 782 | } |
| 783 | |
| 784 | /// Get the count of the recurrence. |
| 785 | #[must_use] |
| 786 | pub fn get_countrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_count().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32> { |
| 787 | self.countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count. |
| 788 | } |
| 789 | |
| 790 | /// Get the until of the recurrence. |
| 791 | #[must_use] |
| 792 | pub fn get_untilrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_until().(&self) -> 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#>> { |
| 793 | self.untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 794 | } |
| 795 | |
| 796 | /// Get the `by_set_pos` of the recurrence. |
| 797 | #[must_use] |
| 798 | pub fn get_week_startrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_week_start().(&self) -> Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday# { |
| 799 | self.week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start. |
| 800 | } |
| 801 | |
| 802 | /// Get the `by_month` of the recurrence. |
| 803 | #[must_use] |
| 804 | pub fn get_by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_set_pos().(&self) -> &[i32] { |
| 805 | &self.by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos. |
| 806 | } |
| 807 | |
| 808 | /// Get the `by_month` of the recurrence. |
| 809 | #[must_use] |
| 810 | pub fn get_by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_month().(&self) -> &[u8] { |
| 811 | &self.by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month. |
| 812 | } |
| 813 | |
| 814 | /// Get the `by_month_day` of the recurrence. |
| 815 | #[must_use] |
| 816 | pub fn get_by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_month_day().(&self) -> &[i8] { |
| 817 | &self.by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day. |
| 818 | } |
| 819 | |
| 820 | /// Get the `by_year_day` of the recurrence. |
| 821 | #[must_use] |
| 822 | pub fn get_by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_year_day().(&self) -> &[i16] { |
| 823 | &self.by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day. |
| 824 | } |
| 825 | |
| 826 | /// Get the `by_hour` of the recurrence. |
| 827 | #[must_use] |
| 828 | pub fn get_by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_week_no().(&self) -> &[i8] { |
| 829 | &self.by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no. |
| 830 | } |
| 831 | |
| 832 | /// Get the `by_hour` of the recurrence. |
| 833 | #[must_use] |
| 834 | pub fn get_by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_weekday().(&self) -> &[NWeekdayrust-analyzer cargo rrule 0.14.0 core/rrule/NWeekday#] { |
| 835 | &self.by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday. |
| 836 | } |
| 837 | |
| 838 | /// Get the `by_hour` of the recurrence. |
| 839 | #[must_use] |
| 840 | pub fn get_by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_hour().(&self) -> &[u8] { |
| 841 | &self.by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour. |
| 842 | } |
| 843 | |
| 844 | /// Get the `by_minute` of the recurrence. |
| 845 | #[must_use] |
| 846 | pub fn get_by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_minute().(&self) -> &[u8] { |
| 847 | &self.by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute. |
| 848 | } |
| 849 | |
| 850 | /// Get the `by_second` of the recurrence. |
| 851 | #[must_use] |
| 852 | pub fn get_by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_second().(&self) -> &[u8] { |
| 853 | &self.by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second. |
| 854 | } |
| 855 | |
| 856 | /// Get the `by_easter` of the recurrence. |
| 857 | #[cfg(feature = "by-easter")] |
| 858 | #[must_use] |
| 859 | pub fn get_by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<S>`]get_by_easter().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&i16> { |
| 860 | self.by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 861 | } |
| 862 | } |