| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, 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#, 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#}; |
| 2 | |
| 3 | use chronorust-analyzer cargo chrono 0.4.40 crate/::Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#; |
| 4 | |
| 5 | use craterust-analyzer cargo rrule 0.14.0 crate/::{ |
| 6 | parserrust-analyzer cargo rrule 0.14.0 parser/::{ |
| 7 | content_linerust-analyzer cargo rrule 0.14.0 parser/content_line/::parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/parameters/::parse_parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/parameters/parse_parameters()., |
| 8 | datetimerust-analyzer cargo rrule 0.14.0 parser/datetime/::{datestring_to_daterust-analyzer cargo rrule 0.14.0 parser/datetime/datestring_to_date()., parse_weekdaysrust-analyzer cargo rrule 0.14.0 parser/datetime/parse_weekdays().}, |
| 9 | str_to_weekdayrust-analyzer cargo rrule 0.14.0 parser/datetime/str_to_weekday()., |
| 10 | utilsrust-analyzer cargo rrule 0.14.0 parser/utils/::parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec()., |
| 11 | ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#, |
| 12 | }, |
| 13 | Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#, RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#, Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#, |
| 14 | }; |
| 15 | |
| 16 | use superrust-analyzer cargo rrule 0.14.0 parser/content_line/::content_line_partsrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/::ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#; |
| 17 | |
| 18 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, 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:, 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:)] |
| 19 | pub enum RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty# { |
| 20 | Freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Freq#, |
| 21 | Untilrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Until#, |
| 22 | Countrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Count#, |
| 23 | Intervalrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Interval#, |
| 24 | BySecondrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#BySecond#, |
| 25 | ByMinuterust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMinute#, |
| 26 | ByHourrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByHour#, |
| 27 | ByDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByDay#, |
| 28 | ByMonthDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMonthDay#, |
| 29 | ByYearDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByYearDay#, |
| 30 | ByWeekNorust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByWeekNo#, |
| 31 | ByMonthrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMonth#, |
| 32 | BySetPosrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#BySetPos#, |
| 33 | Wkstrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Wkst#, |
| 34 | #[cfg(feature = "by-easter")] |
| 35 | ByEasterrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByEaster#, |
| 36 | } |
| 37 | |
| 38 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty# { |
| 39 | type Errrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]Err# = ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#; |
| 40 | |
| 41 | fn from_strrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][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 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr], Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 42 | let prop = match &s.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(). { |
| 43 | "FREQ" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::Freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Freq#, |
| 44 | "UNTIL" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::Untilrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Until#, |
| 45 | "COUNT" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::Countrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Count#, |
| 46 | "INTERVAL" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::Intervalrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Interval#, |
| 47 | "BYSECOND" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::BySecondrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#BySecond#, |
| 48 | "BYMINUTE" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByMinuterust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMinute#, |
| 49 | "BYHOUR" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByHourrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByHour#, |
| 50 | "BYWEEKDAY" | "BYDAY" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByDay#, |
| 51 | "BYMONTHDAY" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByMonthDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMonthDay#, |
| 52 | "BYYEARDAY" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByYearDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByYearDay#, |
| 53 | "BYWEEKNO" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByWeekNorust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByWeekNo#, |
| 54 | "BYMONTH" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByMonthrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMonth#, |
| 55 | "BYSETPOS" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::BySetPosrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#BySetPos#, |
| 56 | "WKST" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::Wkstrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Wkst#, |
| 57 | #[cfg(feature = "by-easter")] |
| 58 | "BYEASTER" => Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[RRuleProperty][FromStr]::ByEasterrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByEaster#, |
| 59 | _ => 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#::UnrecognizedParameterrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#UnrecognizedParameter#(s.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())), |
| 60 | }; |
| 61 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(prop) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#<'_>> for RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#> { |
| 66 | type Errorrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`]Error# = ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#; |
| 67 | |
| 68 | fn try_fromrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`]try_from().(value: ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`], Selfrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 69 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parameters) = value.parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#parameters. { |
| 70 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parameters.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() { |
| 71 | 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#::PropertyParametersNotSupportedrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#PropertyParametersNotSupported#( |
| 72 | parameters.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 73 | )); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | let properties: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = parse_parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/parameters/parse_parameters().(value.valuerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#value.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 78 | |
| 79 | props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().(&properties) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /// Takes a map of [`RRuleProperty`] and returns an [`RRule`]. |
| 84 | #[allow(clippy::too_many_lines)] |
| 85 | fn props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().( |
| 86 | props: &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 87 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#<Unvalidatedrust-analyzer cargo rrule 0.14.0 core/Unvalidated#>, ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#> { |
| 88 | let freq = props |
| 89 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Freq#) |
| 90 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|freq| Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::from_strrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[Frequency][FromStr]from_str().(freq)) |
| 91 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 92 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::MissingPropertyrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#MissingProperty#("FREQ".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().; |
| 93 | let interval = props |
| 94 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Intervalrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Interval#) |
| 95 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|interval| { |
| 96 | interval |
| 97 | .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().() |
| 98 | .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#::InvalidIntervalrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidInterval#(interval.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 99 | }) |
| 100 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 101 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(1); |
| 102 | let count = props |
| 103 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Countrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Count#) |
| 104 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|count| { |
| 105 | count |
| 106 | .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().() |
| 107 | .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#::InvalidCountrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidCount#(count.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 108 | }) |
| 109 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 110 | let until = props |
| 111 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Untilrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Until#) |
| 112 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|until| datestring_to_daterust-analyzer cargo rrule 0.14.0 parser/datetime/datestring_to_date().(until, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "UNTIL")) |
| 113 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 114 | let week_start = props |
| 115 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Wkstrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Wkst#) |
| 116 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|week_start| { |
| 117 | str_to_weekdayrust-analyzer cargo rrule 0.14.0 parser/datetime/str_to_weekday().(week_start) |
| 118 | .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#::InvalidWeekdayStartrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidWeekdayStart#(week_start.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 119 | }) |
| 120 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 121 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(Weekdayrust-analyzer cargo chrono 0.4.40 weekday/Weekday#::Monrust-analyzer cargo chrono 0.4.40 weekday/Weekday#Mon#); |
| 122 | let by_set_pos = props |
| 123 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::BySetPosrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#BySetPos#) |
| 124 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_set_pos| { |
| 125 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_set_pos, |_| true) |
| 126 | .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#::InvalidBySetPosrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidBySetPos#(by_set_pos.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 127 | }) |
| 128 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 129 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 130 | let by_month = props |
| 131 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByMonthrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMonth#) |
| 132 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_month| { |
| 133 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_month, |month| (1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#12).containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(&month)) |
| 134 | .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#::InvalidByMonthrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByMonth#(by_month.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 135 | }) |
| 136 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 137 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 138 | let by_month_day = props |
| 139 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByMonthDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMonthDay#) |
| 140 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_month_day| { |
| 141 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_month_day, |monthday| (-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().31..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#31).containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(&monthday)) |
| 142 | .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#::InvalidByMonthDayrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByMonthDay#(by_month_day.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 143 | }) |
| 144 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 145 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 146 | let by_year_day = props |
| 147 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByYearDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByYearDay#) |
| 148 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_year_day| { |
| 149 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_year_day, |yearday| (-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().366..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#366).containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(&yearday)) |
| 150 | .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#::InvalidByYearDayrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByYearDay#(by_year_day.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 151 | }) |
| 152 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 153 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 154 | let by_week_no = props |
| 155 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByWeekNorust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByWeekNo#) |
| 156 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_week_no| { |
| 157 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_week_no, |weekno| (-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().53..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#53).containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(&weekno)) |
| 158 | .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#::InvalidByWeekNorust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByWeekNo#(by_week_no.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 159 | }) |
| 160 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 161 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 162 | let by_weekday = props |
| 163 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByDayrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByDay#) |
| 164 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_weekday| parse_weekdaysrust-analyzer cargo rrule 0.14.0 parser/datetime/parse_weekdays().(by_weekday)) |
| 165 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 166 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 167 | let by_hour = props |
| 168 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByHourrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByHour#) |
| 169 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_hour| { |
| 170 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_hour, |hour| hour rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().24) |
| 171 | .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#::InvalidByHourrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByHour#(by_hour.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 172 | }) |
| 173 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 174 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 175 | let by_minute = props |
| 176 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByMinuterust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMinute#) |
| 177 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_minute| { |
| 178 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_minute, |minute| minute rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().60) |
| 179 | .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#::InvalidByMinuterust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByMinute#(by_minute.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 180 | }) |
| 181 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 182 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 183 | let by_second = props |
| 184 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::BySecondrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#BySecond#) |
| 185 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|by_second| { |
| 186 | parse_str_to_vecrust-analyzer cargo rrule 0.14.0 parser/utils/parse_str_to_vec().(by_second, |second| second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().60) |
| 187 | .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#::InvalidBySecondrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidBySecond#(by_second.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 188 | }) |
| 189 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 190 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 191 | |
| 192 | #[cfg(not(feature = "by-easter"))] |
| 193 | let by_easter = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 194 | #[cfg(feature = "by-easter")] |
| 195 | let by_easter = props |
| 196 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByEasterrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByEaster#) |
| 197 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|new_by_easter: &Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#| { |
| 198 | i16::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i16][FromStr]from_str().(new_by_easter) |
| 199 | .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#::InvalidByEasterrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByEaster#(new_by_easter.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 200 | }) |
| 201 | .transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 202 | |
| 203 | // Check if mandatory fields are set |
| 204 | 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# { |
| 205 | freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq., |
| 206 | intervalrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#interval., |
| 207 | countrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#count., |
| 208 | untilrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#until., |
| 209 | week_startrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#week_start., |
| 210 | by_set_posrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_set_pos., |
| 211 | by_monthrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month., |
| 212 | by_month_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_month_day., |
| 213 | 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 macros/vec!![], |
| 214 | by_year_dayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_year_day., |
| 215 | by_week_norust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_week_no., |
| 216 | by_weekdayrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_weekday., |
| 217 | by_hourrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_hour., |
| 218 | by_minuterust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_minute., |
| 219 | by_secondrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_second., |
| 220 | by_easterrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#by_easter., |
| 221 | 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#, |
| 222 | }) |
| 223 | } |
| 224 | |
| 225 | #[cfg(test)] |
| 226 | mod testsrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/tests/ { |
| 227 | use craterust-analyzer cargo rrule 0.14.0 crate/::parserrust-analyzer cargo rrule 0.14.0 parser/::content_linerust-analyzer cargo rrule 0.14.0 parser/content_line/::{ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#, PropertyNamerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#}; |
| 228 | |
| 229 | use superrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/::*; |
| 230 | |
| 231 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 232 | fn parses_rrule_content_linerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/tests/parses_rrule_content_line().() { |
| 233 | let tests = [ |
| 234 | ( |
| 235 | ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures# { |
| 236 | property_namerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#property_name.: PropertyNamerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#::RRulerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#RRule#, |
| 237 | parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#parameters.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 238 | valuerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#value.: "FREQ=DAILY", |
| 239 | }, |
| 240 | RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# { |
| 241 | freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily#, |
| 242 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().() |
| 243 | }, |
| 244 | ), |
| 245 | ( |
| 246 | ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures# { |
| 247 | property_namerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#property_name.: PropertyNamerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#::RRulerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#RRule#, |
| 248 | parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#parameters.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 249 | valuerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#value.: "BYHOUR=4;FREQ=DAILY", |
| 250 | }, |
| 251 | RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# { |
| 252 | 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!![4], |
| 253 | freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily#, |
| 254 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().() |
| 255 | }, |
| 256 | ), |
| 257 | ( |
| 258 | ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures# { |
| 259 | property_namerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#property_name.: PropertyNamerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#::RRulerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#RRule#, |
| 260 | parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#parameters.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 261 | // Testing case insensitivity |
| 262 | valuerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#value.: "byhour=4;freQ=DAILY", |
| 263 | }, |
| 264 | RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule# { |
| 265 | 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!![4], |
| 266 | freqrust-analyzer cargo rrule 0.14.0 core/rrule/RRule#freq.: Frequencyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#::Dailyrust-analyzer cargo rrule 0.14.0 core/rrule/Frequency#Daily#, |
| 267 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo rrule 0.14.0 core/rrule/impl#[`RRule<Unvalidated>`][Default]default().() |
| 268 | }, |
| 269 | ), |
| 270 | ]; |
| 271 | |
| 272 | for (input, expected_output) in tests { |
| 273 | let output = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#::try_fromrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`]try_from().(input); |
| 274 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(output, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(expected_output)); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 279 | fn rejects_property_parameters_in_rrule_linerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/tests/rejects_property_parameters_in_rrule_line().() { |
| 280 | let tests = [( |
| 281 | ContentLineCapturesrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures# { |
| 282 | property_namerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#property_name.: PropertyNamerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#::RRulerust-analyzer cargo rrule 0.14.0 parser/content_line/PropertyName#RRule#, |
| 283 | parametersrust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#parameters.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("TZID=Europe/London"), |
| 284 | valuerust-analyzer cargo rrule 0.14.0 parser/content_line/content_line_parts/ContentLineCaptures#value.: "BYHOUR=4", |
| 285 | }, |
| 286 | ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::PropertyParametersNotSupportedrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#PropertyParametersNotSupported#("TZID=Europe/London".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 287 | )]; |
| 288 | |
| 289 | for (input, expected_output) in tests { |
| 290 | let output = RRulerust-analyzer cargo rrule 0.14.0 core/rrule/RRule#::try_fromrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/impl#[`RRule<Unvalidated>`][`TryFrom<ContentLineCaptures<'_>>`]try_from().(input); |
| 291 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(output, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(expected_output)); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 296 | fn rejects_invalid_freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/tests/rejects_invalid_freq().() { |
| 297 | let mut props = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 298 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Freq#, "DAIL".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 299 | let res = props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().(&props); |
| 300 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 301 | res.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), |
| 302 | ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidFrequencyrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidFrequency#("DAIL".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 303 | ); |
| 304 | } |
| 305 | |
| 306 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 307 | fn rejects_invalid_byhourrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/tests/rejects_invalid_byhour().() { |
| 308 | let mut props = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 309 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Freq#, "DAILY".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 310 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByHourrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByHour#, "24".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 311 | let res = props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().(&props); |
| 312 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(res.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidByHourrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByHour#("24".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 313 | |
| 314 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByHourrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByHour#, "5,6,25".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 315 | let res = props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().(&props); |
| 316 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(res.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidByHourrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByHour#("5,6,25".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 317 | } |
| 318 | |
| 319 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 320 | fn rejects_invalid_byminuterust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/tests/rejects_invalid_byminute().() { |
| 321 | let mut props = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 322 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::Freqrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#Freq#, "DAILY".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 323 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByMinuterust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMinute#, "60".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 324 | let res = props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().(&props); |
| 325 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(res.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidByMinuterust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByMinute#("60".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 326 | |
| 327 | props.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(RRulePropertyrust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#::ByMinuterust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/RRuleProperty#ByMinute#, "4,5,64".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 328 | let res = props_to_rrulerust-analyzer cargo rrule 0.14.0 parser/content_line/rule_content_line/props_to_rrule().(&props); |
| 329 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 330 | res.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), |
| 331 | ParseErrorrust-analyzer cargo rrule 0.14.0 parser/error/ParseError#::InvalidByMinuterust-analyzer cargo rrule 0.14.0 parser/error/ParseError#InvalidByMinute#("4,5,64".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 332 | ); |
| 333 | } |
| 334 | } |