| 1 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#; |
| 2 | |
| 3 | use superrust-analyzer cargo jiff 0.2.18 shared/::{ |
| 4 | utilrust-analyzer cargo jiff 0.2.18 shared/util/::{ |
| 5 | array_strrust-analyzer cargo jiff 0.2.18 shared/util/array_str/::Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#, |
| 6 | itimerust-analyzer cargo jiff 0.2.18 shared/util/itime/::{ |
| 7 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#, IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#, IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#, IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#, ITimerust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#, ITimeSecondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimeSecond#, |
| 8 | ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, IWeekdayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IWeekday#, |
| 9 | }, |
| 10 | }, |
| 11 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#, PosixDayTimerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#, PosixDstrust-analyzer cargo jiff 0.2.18 shared/PosixDst#, PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#, PosixRulerust-analyzer cargo jiff 0.2.18 shared/PosixRule#, PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime#, |
| 12 | PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#, |
| 13 | }; |
| 14 | |
| 15 | impl PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#> { |
| 16 | /// Parse a POSIX `TZ` environment variable, assuming it's a rule and not |
| 17 | /// an implementation defined value, from the given bytes. |
| 18 | pub fn parserust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<super::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]parse().( |
| 19 | bytes: &[u8], |
| 20 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#> { |
| 21 | // We enable the IANA v3+ extensions here. (Namely, that the time |
| 22 | // specification hour value has the range `-167..=167` instead of |
| 23 | // `0..=24`.) Requiring strict POSIX rules doesn't seem necessary |
| 24 | // since the extension is a strict superset. Plus, GNU tooling |
| 25 | // seems to accept the extension. |
| 26 | let parser = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#ianav3plus.: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::newrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]new().(bytes) }; |
| 27 | parser.parserust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse().() |
| 28 | } |
| 29 | |
| 30 | // only-jiff-start |
| 31 | /// Like parse, but parses a prefix of the input given and returns whatever |
| 32 | /// is remaining. |
| 33 | pub fn parse_prefixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<super::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]parse_prefix().<'b>( |
| 34 | bytes: &'b [u8], |
| 35 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, &'b [u8]), PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#> |
| 36 | { |
| 37 | let parser = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#ianav3plus.: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::newrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]new().(bytes) }; |
| 38 | parser.parse_prefixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_prefix().() |
| 39 | } |
| 40 | // only-jiff-end |
| 41 | } |
| 42 | |
| 43 | impl<ABBREV: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str> + Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#> PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<ABBREV> { |
| 44 | /// Returns the appropriate time zone offset to use for the given |
| 45 | /// timestamp. |
| 46 | /// |
| 47 | /// If you need information like whether the offset is in DST or not, or |
| 48 | /// the time zone abbreviation, then use `PosixTimeZone::to_offset_info`. |
| 49 | /// But that API may be more expensive to use, so only use it if you need |
| 50 | /// the additional data. |
| 51 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn to_offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]to_offset().(&self, timestamp: ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#) -> IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset# { |
| 52 | let std_offset = self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset..to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(); |
| 53 | if self.dstrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#dst..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 54 | return std_offset; |
| 55 | } |
| 56 | |
| 57 | let dt = timestamp.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 58 | self.dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year.) |
| 59 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|dst_info| dst_info.in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(dt)) |
| 60 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|dst_info| dst_info.offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]offset().().to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().()) |
| 61 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| std_offset) |
| 62 | } |
| 63 | |
| 64 | /// Returns the appropriate time zone offset to use for the given |
| 65 | /// timestamp. |
| 66 | /// |
| 67 | /// This also includes whether the offset returned should be considered |
| 68 | /// to be "DST" or not, along with the time zone abbreviation (e.g., EST |
| 69 | /// for standard time in New York, and EDT for DST in New York). |
| 70 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn to_offset_inforust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]to_offset_info().( |
| 71 | &self, |
| 72 | timestamp: ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, |
| 73 | ) -> (IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#, &'_ str, bool) { |
| 74 | let std_offset = self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset..to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(); |
| 75 | if self.dstrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#dst..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 76 | return (std_offset, self.std_abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), false); |
| 77 | } |
| 78 | |
| 79 | let dt = timestamp.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 80 | self.dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year.) |
| 81 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|dst_info| dst_info.in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(dt)) |
| 82 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|dst_info| { |
| 83 | ( |
| 84 | dst_info.offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]offset().().to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(), |
| 85 | dst_info.dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst..abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixDst#abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), |
| 86 | true, |
| 87 | ) |
| 88 | }) |
| 89 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| (std_offset, self.std_abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), false)) |
| 90 | } |
| 91 | |
| 92 | /// Returns a possibly ambiguous timestamp for the given civil datetime. |
| 93 | /// |
| 94 | /// The given datetime should correspond to the "wall" clock time of what |
| 95 | /// humans use to tell time for this time zone. |
| 96 | /// |
| 97 | /// Note that "ambiguous timestamp" is represented by the possible |
| 98 | /// selection of offsets that could be applied to the given datetime. In |
| 99 | /// general, it is only ambiguous around transitions to-and-from DST. The |
| 100 | /// ambiguity can arise as a "fold" (when a particular wall clock time is |
| 101 | /// repeated) or as a "gap" (when a particular wall clock time is skipped |
| 102 | /// entirely). |
| 103 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn to_ambiguous_kindrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]to_ambiguous_kind().(&self, dt: IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#) -> IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset# { |
| 104 | let year = dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year.; |
| 105 | let std_offset = self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset..to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(); |
| 106 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dst_info) = self.dst_info_wallrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_wall().(year) else { |
| 107 | return IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous# { offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous#offset.: std_offset }; |
| 108 | }; |
| 109 | let dst_offset = dst_info.offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]offset().().to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(); |
| 110 | let diff = dst_offset.secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().std_offset.secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second.; |
| 111 | // When the difference between DST and standard is positive, that means |
| 112 | // STD->DST results in a gap while DST->STD results in a fold. However, |
| 113 | // when the difference is negative, that means STD->DST results in a |
| 114 | // fold while DST->STD results in a gap. The former is by far the most |
| 115 | // common. The latter is a bit weird, but real cases do exist. For |
| 116 | // example, Dublin has DST in winter (UTC+01) and STD in the summer |
| 117 | // (UTC+00). |
| 118 | // |
| 119 | // When the difference is zero, then we have a weird POSIX time zone |
| 120 | // where a DST transition rule was specified, but was set to explicitly |
| 121 | // be the same as STD. In this case, there can be no ambiguity. (The |
| 122 | // zero case is strictly redundant. Both the diff < 0 and diff > 0 |
| 123 | // cases handle the zero case correctly. But we write it out for |
| 124 | // clarity.) |
| 125 | if diff rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 126 | debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(std_offset, dst_offset); |
| 127 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous# { offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous#offset.: std_offset } |
| 128 | } else if diff.is_negativerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]is_negative().() { |
| 129 | // For DST transitions that always move behind one hour, ambiguous |
| 130 | // timestamps only occur when the given civil datetime falls in the |
| 131 | // standard time range. |
| 132 | if dst_info.in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(dt) { |
| 133 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous# { offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous#offset.: dst_offset } |
| 134 | } else { |
| 135 | let fold_start = dst_info.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start..saturating_add_secondsrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]saturating_add_seconds().(diff); |
| 136 | let gap_end = |
| 137 | dst_info.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end..saturating_add_secondsrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]saturating_add_seconds().(diff.saturating_negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]saturating_neg().()); |
| 138 | if fold_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().dt && dt 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().dst_info.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start. { |
| 139 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Foldrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Fold# { |
| 140 | beforerust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Fold#before.: std_offset, |
| 141 | afterrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Fold#after.: dst_offset, |
| 142 | } |
| 143 | } else if dst_info.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().dt && dt 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().gap_end { |
| 144 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Gaprust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Gap# { |
| 145 | beforerust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Gap#before.: dst_offset, |
| 146 | afterrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Gap#after.: std_offset, |
| 147 | } |
| 148 | } else { |
| 149 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous# { offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous#offset.: std_offset } |
| 150 | } |
| 151 | } |
| 152 | } else { |
| 153 | // For DST transitions that always move ahead one hour, ambiguous |
| 154 | // timestamps only occur when the given civil datetime falls in the |
| 155 | // DST range. |
| 156 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dst_info.in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(dt) { |
| 157 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous# { offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous#offset.: std_offset } |
| 158 | } else { |
| 159 | // PERF: I wonder if it makes sense to pre-compute these? |
| 160 | // Probably not, because we have to do it based on year of |
| 161 | // datetime given. But if we ever add a "caching" layer for |
| 162 | // POSIX time zones, then it might be worth adding these to it. |
| 163 | let gap_end = dst_info.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start..saturating_add_secondsrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]saturating_add_seconds().(diff); |
| 164 | let fold_start = |
| 165 | dst_info.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end..saturating_add_secondsrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]saturating_add_seconds().(diff.saturating_negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]saturating_neg().()); |
| 166 | if dst_info.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().dt && dt 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().gap_end { |
| 167 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Gaprust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Gap# { |
| 168 | beforerust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Gap#before.: std_offset, |
| 169 | afterrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Gap#after.: dst_offset, |
| 170 | } |
| 171 | } else if fold_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().dt && dt 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().dst_info.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. { |
| 172 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Foldrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Fold# { |
| 173 | beforerust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Fold#before.: dst_offset, |
| 174 | afterrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Fold#after.: std_offset, |
| 175 | } |
| 176 | } else { |
| 177 | IAmbiguousOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous# { offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IAmbiguousOffset#Unambiguous#offset.: dst_offset } |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /// Returns the timestamp of the most recent time zone transition prior |
| 184 | /// to the timestamp given. If one doesn't exist, `None` is returned. |
| 185 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn previous_transitionrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]previous_transition().( |
| 186 | &self, |
| 187 | timestamp: ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, |
| 188 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#, &'_ str, bool)> { |
| 189 | let dt = timestamp.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 190 | let dst_info = self.dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 191 | let (earlier, later) = dst_info.orderedrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]ordered().(); |
| 192 | let (prev, dst_info) = if dt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().later { |
| 193 | (later, dst_info) |
| 194 | } else if dt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().earlier { |
| 195 | (earlier, dst_info) |
| 196 | } else { |
| 197 | let prev_year = dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..prev_yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDate]prev_year().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 198 | let dst_info = self.dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(prev_year)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 199 | let (_, later) = dst_info.orderedrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]ordered().(); |
| 200 | (later, dst_info) |
| 201 | }; |
| 202 | |
| 203 | let timestamp = prev.to_timestamp_checkedrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]to_timestamp_checked().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 204 | let dt = timestamp.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 205 | let (offset, abbrev, dst) = if dst_info.in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(dt) { |
| 206 | (dst_info.offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]offset().(), dst_info.dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst..abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixDst#abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), true) |
| 207 | } else { |
| 208 | (&self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset., self.std_abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), false) |
| 209 | }; |
| 210 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((timestamp, offset.to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(), abbrev, dst)) |
| 211 | } |
| 212 | |
| 213 | /// Returns the timestamp of the soonest time zone transition after the |
| 214 | /// timestamp given. If one doesn't exist, `None` is returned. |
| 215 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn next_transitionrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]next_transition().( |
| 216 | &self, |
| 217 | timestamp: ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, |
| 218 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#, &'_ str, bool)> { |
| 219 | let dt = timestamp.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 220 | let dst_info = self.dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 221 | let (earlier, later) = dst_info.orderedrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]ordered().(); |
| 222 | let (next, dst_info) = if dt 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().earlier { |
| 223 | (earlier, dst_info) |
| 224 | } else if dt 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().later { |
| 225 | (later, dst_info) |
| 226 | } else { |
| 227 | let next_year = dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..next_yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDate]next_year().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 228 | let dst_info = self.dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(next_year)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 229 | let (earlier, _) = dst_info.orderedrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]ordered().(); |
| 230 | (earlier, dst_info) |
| 231 | }; |
| 232 | |
| 233 | let timestamp = next.to_timestamp_checkedrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]to_timestamp_checked().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 234 | let dt = timestamp.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 235 | let (offset, abbrev, dst) = if dst_info.in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(dt) { |
| 236 | (dst_info.offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]offset().(), dst_info.dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst..abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixDst#abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), true) |
| 237 | } else { |
| 238 | (&self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset., self.std_abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), false) |
| 239 | }; |
| 240 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((timestamp, offset.to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(), abbrev, dst)) |
| 241 | } |
| 242 | |
| 243 | /// Returns the range in which DST occurs. |
| 244 | /// |
| 245 | /// The civil datetimes returned are in UTC. This is useful for determining |
| 246 | /// whether a timestamp is in DST or not. |
| 247 | fn dst_info_utcrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_utc().(&self, year: i16) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#<'_, ABBREV>> { |
| 248 | let dst = self.dstrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#dst..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 249 | // DST time starts with respect to standard time, so offset it by the |
| 250 | // standard offset. |
| 251 | let start = |
| 252 | dst.rulerust-analyzer cargo jiff 0.2.18 shared/PosixDst#rule..startrust-analyzer cargo jiff 0.2.18 shared/PosixRule#start..to_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime]to_datetime().(year, self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset..to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().()); |
| 253 | // DST time ends with respect to DST time, so offset it by the DST |
| 254 | // offset. |
| 255 | let mut end = dst.rulerust-analyzer cargo jiff 0.2.18 shared/PosixDst#rule..endrust-analyzer cargo jiff 0.2.18 shared/PosixRule#end..to_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime]to_datetime().(year, dst.offsetrust-analyzer cargo jiff 0.2.18 shared/PosixDst#offset..to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().()); |
| 256 | // This is a whacky special case when DST is permanent, but the math |
| 257 | // using to calculate the start/end datetimes ends up leaving a gap |
| 258 | // for standard time to appear. In which case, it's possible for a |
| 259 | // timestamp at the end of a calendar year to get standard time when |
| 260 | // it really should be DST. |
| 261 | // |
| 262 | // We detect this case by re-interpreting the end of the boundary using |
| 263 | // the standard offset. If we get a datetime that is in a different |
| 264 | // year, then it follows that standard time is actually impossible to |
| 265 | // occur. |
| 266 | // |
| 267 | // These weird POSIX time zones can occur as the TZ strings in |
| 268 | // a TZif file compiled using rearguard semantics. For example, |
| 269 | // `Africa/Casablanca` has: |
| 270 | // |
| 271 | // XXX-2<+01>-1,0/0,J365/23 |
| 272 | // |
| 273 | // Notice here that DST is actually one hour *behind* (it is usually |
| 274 | // one hour *ahead*) _and_ it ends at 23:00:00 on the last day of the |
| 275 | // year. But if it ends at 23:00, then jumping to standard time moves |
| 276 | // the clocks *forward*. Which would bring us to 00:00:00 on the first |
| 277 | // of the next year... but that is when DST begins! Hence, DST is |
| 278 | // permanent. |
| 279 | // |
| 280 | // Ideally, this could just be handled by our math automatically. But |
| 281 | // I couldn't figure out how to make it work. In particular, in the |
| 282 | // above example for year 2087, we get |
| 283 | // |
| 284 | // start == 2087-01-01T00:00:00Z |
| 285 | // end == 2087-12-31T22:00:00Z |
| 286 | // |
| 287 | // Which leaves a two hour gap for a timestamp to get erroneously |
| 288 | // categorized as standard time. |
| 289 | // |
| 290 | // ... so we special case this. We could pre-compute whether a POSIX |
| 291 | // time zone is in permanent DST at construction time, but it's not |
| 292 | // obvious to me that it's worth it. Especially since this is an |
| 293 | // exceptionally rare case. |
| 294 | // |
| 295 | // Note that I did try to consult tzcode's (incredibly inscrutable) |
| 296 | // `localtime` implementation to figure out how they deal with it. At |
| 297 | // first, it looks like they don't have any special handling for this |
| 298 | // case. But looking more closely, they skip any time zone transitions |
| 299 | // generated by POSIX time zones whose rule spans more than 1 year: |
| 300 | // |
| 301 | // https://github.com/eggert/tz/blob/8d65db9786753f3b263087e31c59d191561d63e3/localtime.c#L1717-L1735 |
| 302 | // |
| 303 | // By just ignoring them, I think it achieves the desired effect of |
| 304 | // permanent DST. But I'm not 100% confident in my understanding of |
| 305 | // the code. |
| 306 | if start.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#month. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq().1 |
| 307 | && start.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..dayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#day. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq().1 |
| 308 | && start.timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time. rust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime][`PartialEq<Self>`]eq().==rust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime][`PartialEq<Self>`]eq(). rust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime][`PartialEq<Self>`]eq().ITimerust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#::MINrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime]MIN. |
| 309 | // NOTE: This should come last because it is potentially expensive. |
| 310 | && year |
| 311 | !=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().end.saturating_add_secondsrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDateTime]saturating_add_seconds().(self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset..secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second.).daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year. |
| 312 | { |
| 313 | end = IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime# { |
| 314 | daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date.: IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate# { yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year., monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#month.: 12, dayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#day.: 31 }, |
| 315 | timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time.: ITimerust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#::MAXrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime]MAX., |
| 316 | }; |
| 317 | } |
| 318 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo# { dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst., startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start., endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. }) |
| 319 | } |
| 320 | |
| 321 | /// Returns the range in which DST occurs. |
| 322 | /// |
| 323 | /// The civil datetimes returned are in "wall clock time." That is, they |
| 324 | /// represent the transitions as they are seen from humans reading a clock |
| 325 | /// within the geographic location of that time zone. |
| 326 | fn dst_info_wallrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]dst_info_wall().(&self, year: i16) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#<'_, ABBREV>> { |
| 327 | let dst = self.dstrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#dst..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 328 | // POSIX time zones express their DST transitions in terms of wall |
| 329 | // clock time. Since this method specifically is returning wall |
| 330 | // clock times, we don't want to offset our datetimes at all. |
| 331 | let start = dst.rulerust-analyzer cargo jiff 0.2.18 shared/PosixDst#rule..startrust-analyzer cargo jiff 0.2.18 shared/PosixRule#start..to_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime]to_datetime().(year, IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 332 | let end = dst.rulerust-analyzer cargo jiff 0.2.18 shared/PosixDst#rule..endrust-analyzer cargo jiff 0.2.18 shared/PosixRule#end..to_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime]to_datetime().(year, IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTCrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IOffset]UTC.); |
| 333 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo# { dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst., startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start., endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. }) |
| 334 | } |
| 335 | |
| 336 | /// Returns the DST transition rule. This panics if this time zone doesn't |
| 337 | /// have DST. |
| 338 | #[cfg(test)] |
| 339 | fn rule(&self) -> &PosixRulerust-analyzer cargo jiff 0.2.18 shared/PosixRule# { |
| 340 | &selfrust-analyzer cargo jiff 0.2.18 shared/posix/.dst.as_ref().unwrap().rule |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | impl<ABBREV: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<ABBREV> { |
| 345 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 346 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`AbbreviationDisplay<S>`][Display]fmt().( |
| 347 | &AbbreviationDisplayrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationDisplay#(self.std_abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().()), |
| 348 | f, |
| 349 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 350 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset][Display]fmt().(&self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 351 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref dst) = self.dstrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#dst. { |
| 352 | dst.displayrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixDst<ABBREV>`]display().(&self.std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 353 | } |
| 354 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | impl<ABBREV: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>> PosixDstrust-analyzer cargo jiff 0.2.18 shared/PosixDst#<ABBREV> { |
| 359 | fn displayrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixDst<ABBREV>`]display().( |
| 360 | &self, |
| 361 | std_offset: &PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#, |
| 362 | f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#, |
| 363 | ) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 364 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`AbbreviationDisplay<S>`][Display]fmt().( |
| 365 | &AbbreviationDisplayrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationDisplay#(self.abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixDst#abbrev..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().()), |
| 366 | f, |
| 367 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 368 | // The overwhelming common case is that DST is exactly one hour ahead |
| 369 | // of standard time. So common that this is the default. So don't write |
| 370 | // the offset if we don't need to. |
| 371 | let default = PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset# { secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second.: std_offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().3600 }; |
| 372 | if self.offsetrust-analyzer cargo jiff 0.2.18 shared/PosixDst#offset. 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().default { |
| 373 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset][Display]fmt().(&self.offsetrust-analyzer cargo jiff 0.2.18 shared/PosixDst#offset., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 374 | } |
| 375 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(",")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 376 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixRule][Display]fmt().(&self.rulerust-analyzer cargo jiff 0.2.18 shared/PosixDst#rule., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 377 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixRulerust-analyzer cargo jiff 0.2.18 shared/PosixRule# { |
| 382 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixRule][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 383 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime][Display]fmt().(&self.startrust-analyzer cargo jiff 0.2.18 shared/PosixRule#start., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 384 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(",")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 385 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime][Display]fmt().(&self.endrust-analyzer cargo jiff 0.2.18 shared/PosixRule#end., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 386 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | impl PosixDayTimerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime# { |
| 391 | /// Turns this POSIX datetime spec into a civil datetime in the year given |
| 392 | /// with the given offset. The datetimes returned are offset by the given |
| 393 | /// offset. For wall clock time, an offset of `0` should be given. For |
| 394 | /// UTC time, the offset (standard or DST) corresponding to this time |
| 395 | /// spec should be given. |
| 396 | /// |
| 397 | /// The datetime returned is guaranteed to have a year component equal |
| 398 | /// to the year given. This guarantee is upheld even when the datetime |
| 399 | /// specification (combined with the offset) would extend past the end of |
| 400 | /// the year (or before the start of the year). In this case, the maximal |
| 401 | /// (or minimal) datetime for the given year is returned. |
| 402 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn to_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime]to_datetime().(&self, year: i16, offset: IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#) -> IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime# { |
| 403 | let mkmin = || IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime# { |
| 404 | daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date.: IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate# { yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year., monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#month.: 1, dayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#day.: 1 }, |
| 405 | timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time.: ITimerust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#::MINrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime]MIN., |
| 406 | }; |
| 407 | let mkmax = || IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime# { |
| 408 | daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date.: IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate# { yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year., monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#month.: 12, dayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#day.: 31 }, |
| 409 | timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time.: ITimerust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#::MAXrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITime]MAX., |
| 410 | }; |
| 411 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(date) = self.daterust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#date..to_daterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDay]to_date().(year) else { return mkmax() }; |
| 412 | // The range on `self.time` is `-604799..=604799`, and the range |
| 413 | // on `offset.second` is `-93599..=93599`. Therefore, subtracting |
| 414 | // them can never overflow an `i32`. |
| 415 | let offset = self.timerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#time..secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().offset.secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second.; |
| 416 | // If the time goes negative or above 86400, then we might have |
| 417 | // to adjust our date. |
| 418 | let days = offset.div_euclidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]div_euclid().(86400); |
| 419 | let second = offset.rem_euclidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]rem_euclid().(86400); |
| 420 | |
| 421 | let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(date) = date.checked_add_daysrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDate]checked_add_days().(days) else { |
| 422 | return if offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 { mkmin() } else { mkmax() }; |
| 423 | }; |
| 424 | if date.yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]lt().year { |
| 425 | mkmin() |
| 426 | } else if date.yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]gt().year { |
| 427 | mkmax() |
| 428 | } else { |
| 429 | let time = ITimeSecondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimeSecond# { secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimeSecond#second. }.to_timerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimeSecond]to_time().(); |
| 430 | IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime# { daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date., timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time. } |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixDayTimerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime# { |
| 436 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDayTime][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 437 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDay][Display]fmt().(&self.daterust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#date., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 438 | // This is the default time, so don't write it if we |
| 439 | // don't need to. |
| 440 | if self.timerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#time. 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().PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime#::DEFAULTrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTime]DEFAULT. { |
| 441 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("/")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 442 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTime][Display]fmt().(&self.timerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#time., f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 443 | } |
| 444 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | impl PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay# { |
| 449 | /// Convert this date specification to a civil date in the year given. |
| 450 | /// |
| 451 | /// If this date specification couldn't be turned into a date in the year |
| 452 | /// given, then `None` is returned. This happens when `366` is given as |
| 453 | /// a day, but the year given is not a leap year. In this case, callers may |
| 454 | /// want to assume a datetime that is maximal for the year given. |
| 455 | fn to_daterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDay]to_date().(&self, year: i16) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#> { |
| 456 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 457 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::JulianOnerust-analyzer cargo jiff 0.2.18 shared/PosixDay#JulianOne#(day) => { |
| 458 | // Parsing validates that our day is 1-365 which will always |
| 459 | // succeed for all possible year values. That is, every valid |
| 460 | // year has a December 31. |
| 461 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#( |
| 462 | IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#::from_day_of_year_no_leaprust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDate]from_day_of_year_no_leap().(year, day) |
| 463 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Julian `J day` should be in bounds"), |
| 464 | ) |
| 465 | } |
| 466 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::JulianZerorust-analyzer cargo jiff 0.2.18 shared/PosixDay#JulianZero#(day) => { |
| 467 | // OK because our value for `day` is validated to be `0..=365`, |
| 468 | // and since it is an `i16`, it is always valid to add 1. |
| 469 | // |
| 470 | // Also, while `day+1` is guaranteed to be in `1..=366`, it is |
| 471 | // possible that `366` is invalid, for when `year` is not a |
| 472 | // leap year. In this case, we throw our hands up, and ask the |
| 473 | // caller to make a decision for how to deal with it. Why does |
| 474 | // POSIX go out of its way to specifically not specify behavior |
| 475 | // in error cases? |
| 476 | IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#::from_day_of_yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDate]from_day_of_year().(year, day rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][`Add<Self>`]add().1).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() |
| 477 | } |
| 478 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::WeekdayOfMonthrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth# { monthrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#month., weekrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#week., weekdayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#weekday. } => { |
| 479 | let weekday = IWeekdayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IWeekday#::from_sunday_zero_offsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IWeekday]from_sunday_zero_offset().(weekday); |
| 480 | let first = IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate# { yearrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#year., monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#month., dayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#day.: 1 }; |
| 481 | let week = if week rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialEq<Self>`]eq().5 { -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1 } else { week }; |
| 482 | debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(week == -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1 || (1..=4).containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(&week)); |
| 483 | // This is maybe non-obvious, but this will always succeed |
| 484 | // because it can only fail when the week number is one of |
| 485 | // {-5, 0, 5}. Since we've validated that 'week' is in 1..=5, |
| 486 | // we know it can't be 0. Moreover, because of the conditional |
| 487 | // above and since `5` actually means "last weekday of month," |
| 488 | // that case will always translate to `-1`. |
| 489 | // |
| 490 | // Also, I looked at how other libraries deal with this case, |
| 491 | // and almost all of them just do a bunch of inline hairy |
| 492 | // arithmetic here. I suppose I could be reduced to such |
| 493 | // things if perf called for it, but we have a nice civil date |
| 494 | // abstraction. So use it, god damn it. (Well, we did, and now |
| 495 | // we have a lower level IDate abstraction. But it's still |
| 496 | // an abstraction!) |
| 497 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#( |
| 498 | first |
| 499 | .nth_weekday_of_monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[IDate]nth_weekday_of_month().(week, weekday) |
| 500 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("nth weekday always exists"), |
| 501 | ) |
| 502 | } |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay# { |
| 508 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDay][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 509 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 510 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::JulianOnerust-analyzer cargo jiff 0.2.18 shared/PosixDay#JulianOne#(n) => { |
| 511 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("J")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 512 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[i16][Display]fmt().(&n, f) |
| 513 | } |
| 514 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::JulianZerorust-analyzer cargo jiff 0.2.18 shared/PosixDay#JulianZero#(n) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[i16][Display]fmt().(&n, f), |
| 515 | PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::WeekdayOfMonthrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth# { monthrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#month., weekrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#week., weekdayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#weekday. } => { |
| 516 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("M")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 517 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[i8][Display]fmt().(&month, f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 518 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(".")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 519 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[i8][Display]fmt().(&week, f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 520 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(".")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 521 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[i8][Display]fmt().(&weekday, f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 522 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | impl PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime# { |
| 529 | const DEFAULTrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTime]DEFAULT.: PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime# = PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime# { secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second.: 2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().60 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().60 }; |
| 530 | } |
| 531 | |
| 532 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime# { |
| 533 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTime][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 534 | if self.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second..is_negativerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]is_negative().() { |
| 535 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("-")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 536 | // The default is positive, so when |
| 537 | // positive, we write nothing. |
| 538 | } |
| 539 | let second = self.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second..unsigned_absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]unsigned_abs().(); |
| 540 | let h = second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().3600; |
| 541 | let m = (second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().60) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60; |
| 542 | let s = second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60; |
| 543 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[u32][Display]fmt().(&h, f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 544 | if m rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 || s rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 { |
| 545 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ":{m:02}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 546 | if s rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 { |
| 547 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ":{s:02}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 548 | } |
| 549 | } |
| 550 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | impl PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset# { |
| 555 | fn to_ioffsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset]to_ioffset().(&self) -> IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset# { |
| 556 | IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset# { secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second.: self.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. } |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset# { |
| 561 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffset][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 562 | // Yes, this is backwards. Blame POSIX. |
| 563 | // N.B. `+` is the default, so we don't |
| 564 | // need to write that out. |
| 565 | if self.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().0 { |
| 566 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("-")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 567 | } |
| 568 | let second = self.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second..unsigned_absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]unsigned_abs().(); |
| 569 | let h = second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().3600; |
| 570 | let m = (second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().60) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60; |
| 571 | let s = second rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().60; |
| 572 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/imp/impl#[u32][Display]fmt().(&h, f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 573 | if m rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 || s rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 { |
| 574 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ":{m:02}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 575 | if s rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 { |
| 576 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ":{s:02}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 577 | } |
| 578 | } |
| 579 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | /// A helper type for formatting a time zone abbreviation. |
| 584 | /// |
| 585 | /// Basically, this will write the `<` and `>` quotes if necessary, and |
| 586 | /// otherwise write out the abbreviation in its unquoted form. |
| 587 | #[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:)] |
| 588 | struct AbbreviationDisplayrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationDisplay#<S>(S); |
| 589 | |
| 590 | impl<S: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for AbbreviationDisplayrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationDisplay#<S> { |
| 591 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`AbbreviationDisplay<S>`][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 592 | let s = self.0rust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationDisplay#0..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(); |
| 593 | if s.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|ch| ch rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'+' || ch rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'-') { |
| 594 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("<")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 595 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`&T`][Display]fmt().(&s, f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 596 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(">") |
| 597 | } else { |
| 598 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`&T`][Display]fmt().(&s, f) |
| 599 | } |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | /// The daylight saving time (DST) info for a POSIX time zone in a particular |
| 604 | /// year. |
| 605 | #[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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 606 | struct DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#<'a, ABBREV> { |
| 607 | /// The DST transition rule that generated this info. |
| 608 | dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst.: &'a PosixDstrust-analyzer cargo jiff 0.2.18 shared/PosixDst#<ABBREV>, |
| 609 | /// The start time (inclusive) that DST begins. |
| 610 | /// |
| 611 | /// Note that this may be greater than `end`. This tends to happen in the |
| 612 | /// southern hemisphere. |
| 613 | /// |
| 614 | /// Note also that this may be in UTC or in wall clock civil |
| 615 | /// time. It depends on whether `PosixTimeZone::dst_info_utc` or |
| 616 | /// `PosixTimeZone::dst_info_wall` was used. |
| 617 | startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start.: IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#, |
| 618 | /// The end time (exclusive) that DST ends. |
| 619 | /// |
| 620 | /// Note that this may be less than `start`. This tends to happen in the |
| 621 | /// southern hemisphere. |
| 622 | /// |
| 623 | /// Note also that this may be in UTC or in wall clock civil |
| 624 | /// time. It depends on whether `PosixTimeZone::dst_info_utc` or |
| 625 | /// `PosixTimeZone::dst_info_wall` was used. |
| 626 | endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end.: IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#, |
| 627 | } |
| 628 | |
| 629 | impl<'a, ABBREV> DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#<'a, ABBREV> { |
| 630 | /// Returns true if and only if the given civil datetime ought to be |
| 631 | /// considered in DST. |
| 632 | fn in_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]in_dst().(&self, utc_dt: IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#) -> bool { |
| 633 | if self.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().self.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. { |
| 634 | self.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().utc_dt && utc_dt 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().self.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. |
| 635 | } else { |
| 636 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(self.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().utc_dt && utc_dt 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().self.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start.) |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | /// Returns the earlier and later times for this DST info. |
| 641 | fn orderedrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]ordered().(&self) -> (IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#, IDateTimerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#) { |
| 642 | if self.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().self.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end. { |
| 643 | (self.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start., self.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end.) |
| 644 | } else { |
| 645 | (self.endrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#end., self.startrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#start.) |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | /// Returns the DST offset. |
| 650 | fn offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`DstInfo<'a, ABBREV>`]offset().(&self) -> &PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset# { |
| 651 | &self.dstrust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo#dst..offsetrust-analyzer cargo jiff 0.2.18 shared/PosixDst#offset. |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | /// A parser for POSIX time zones. |
| 656 | #[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:)] |
| 657 | struct Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#<'s> { |
| 658 | /// The `TZ` string that we're parsing. |
| 659 | tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz.: &'s [u8], |
| 660 | /// The parser's current position in `tz`. |
| 661 | posrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#pos.: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#<usize>, |
| 662 | /// Whether to use IANA rules, i.e., when parsing a TZ string in a TZif |
| 663 | /// file of version 3 or greater. From `tzfile(5)`: |
| 664 | /// |
| 665 | /// > First, the hours part of its transition times may be signed and range |
| 666 | /// > from `-167` through `167` instead of the POSIX-required unsigned |
| 667 | /// > values from `0` through `24`. Second, DST is in effect all year if |
| 668 | /// > it starts January 1 at 00:00 and ends December 31 at 24:00 plus the |
| 669 | /// > difference between daylight saving and standard time. |
| 670 | /// |
| 671 | /// At time of writing, I don't think I understand the significance of |
| 672 | /// the second part above. (RFC 8536 elaborates that it is meant to be an |
| 673 | /// explicit clarification of something that POSIX itself implies.) But the |
| 674 | /// first part is clear: it permits the hours to be a bigger range. |
| 675 | ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#ianav3plus.: bool, |
| 676 | } |
| 677 | |
| 678 | impl<'s> Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#<'s> { |
| 679 | /// Create a new parser for extracting a POSIX time zone from the given |
| 680 | /// bytes. |
| 681 | fn newrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]new().<B: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>>(tz: &'s B) -> Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#<'s> { |
| 682 | Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { |
| 683 | tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz.: tz.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().(), |
| 684 | posrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#pos.: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::Cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/Cell#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`Cell<T>`]new().(0), |
| 685 | ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#ianav3plus.: false, |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | /// Parses a POSIX time zone from the current position of the parser and |
| 690 | /// ensures that the entire TZ string corresponds to a single valid POSIX |
| 691 | /// time zone. |
| 692 | fn parserust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse().( |
| 693 | &self, |
| 694 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#> { |
| 695 | let (time_zone, remaining) = self.parse_prefixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_prefix().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 696 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().remaining.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 697 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::FoundRemainingrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundRemaining#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 698 | } |
| 699 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(time_zone) |
| 700 | } |
| 701 | |
| 702 | /// Parses a POSIX time zone from the current position of the parser and |
| 703 | /// returns the remaining input. |
| 704 | fn parse_prefixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_prefix().( |
| 705 | &self, |
| 706 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, &'s [u8]), PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#> |
| 707 | { |
| 708 | let time_zone = self.parse_posix_time_zonerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_time_zone().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 709 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((time_zone, self.remainingrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]remaining().())) |
| 710 | } |
| 711 | |
| 712 | /// Parse a POSIX time zone from the current position of the parser. |
| 713 | /// |
| 714 | /// Upon success, the parser will be positioned immediately following the |
| 715 | /// TZ string. |
| 716 | fn parse_posix_time_zonerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_time_zone().( |
| 717 | &self, |
| 718 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#> { |
| 719 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 720 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::Emptyrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#Empty#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 721 | } |
| 722 | let std_abbrev = |
| 723 | self.parse_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_abbreviation().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::AbbreviationStdrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#AbbreviationStd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 724 | let std_offset = |
| 725 | self.parse_posix_offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_offset().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::OffsetStdrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#OffsetStd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 726 | let mut dst = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 727 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() |
| 728 | && (self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().().is_ascii_alphabeticrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii_alphabetic().() || self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'<') |
| 729 | { |
| 730 | dst = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.parse_posix_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_dst().(&std_offset)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 731 | } |
| 732 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone# { std_abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_abbrev., std_offsetrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#std_offset., dstrust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#dst. }) |
| 733 | } |
| 734 | |
| 735 | /// Parse a DST zone with an optional explicit transition rule. |
| 736 | /// |
| 737 | /// This assumes the parser is positioned at the first byte of the DST |
| 738 | /// abbreviation. |
| 739 | /// |
| 740 | /// Upon success, the parser will be positioned immediately after the end |
| 741 | /// of the DST transition rule (which might just be the abbreviation, but |
| 742 | /// might also include explicit start/end datetime specifications). |
| 743 | fn parse_posix_dstrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_dst().( |
| 744 | &self, |
| 745 | std_offset: &PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#, |
| 746 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixDstrust-analyzer cargo jiff 0.2.18 shared/PosixDst#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#> { |
| 747 | let abbrev = |
| 748 | self.parse_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_abbreviation().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::AbbreviationDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#AbbreviationDst#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 749 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 750 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::FoundDstNoRulerust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundDstNoRule#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 751 | } |
| 752 | // This is the default: one hour ahead of standard time. We may |
| 753 | // override this if the DST portion specifies an offset. (But it |
| 754 | // usually doesn't.) |
| 755 | let mut offset = PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset# { secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second.: std_offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().3600 }; |
| 756 | if self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b',' { |
| 757 | offset = |
| 758 | self.parse_posix_offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_offset().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::OffsetDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#OffsetDst#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 759 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 760 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::FoundDstNoRuleWithOffsetrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundDstNoRuleWithOffset#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 761 | } |
| 762 | } |
| 763 | if self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b',' { |
| 764 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::ExpectedCommaAfterDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#ExpectedCommaAfterDst#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 765 | } |
| 766 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 767 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::FoundEndAfterCommarust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundEndAfterComma#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 768 | } |
| 769 | let rule = self.parse_rulerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_rule().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::Rulerust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#Rule#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 770 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PosixDstrust-analyzer cargo jiff 0.2.18 shared/PosixDst# { abbrevrust-analyzer cargo jiff 0.2.18 shared/PosixDst#abbrev., offsetrust-analyzer cargo jiff 0.2.18 shared/PosixDst#offset., rulerust-analyzer cargo jiff 0.2.18 shared/PosixDst#rule. }) |
| 771 | } |
| 772 | |
| 773 | /// Parse a time zone abbreviation. |
| 774 | /// |
| 775 | /// This assumes the parser is positioned at the first byte of |
| 776 | /// the abbreviation. This is either the first character in the |
| 777 | /// abbreviation, or the opening quote of a quoted abbreviation. |
| 778 | /// |
| 779 | /// Upon success, the parser will be positioned immediately following |
| 780 | /// the abbreviation name. |
| 781 | /// |
| 782 | /// The string returned is guaranteed to be no more than 30 bytes. |
| 783 | /// (This restriction is somewhat arbitrary, but it's so we can put |
| 784 | /// the abbreviation in a fixed capacity array.) |
| 785 | fn parse_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_abbreviation().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#, AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#> { |
| 786 | if self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'<' { |
| 787 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 788 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#::Quotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Quoted#( |
| 789 | QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::UnexpectedEndAfterOpeningrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedEndAfterOpening#, |
| 790 | )); |
| 791 | } |
| 792 | self.parse_quoted_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_quoted_abbreviation().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#::Quotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Quoted#) |
| 793 | } else { |
| 794 | self.parse_unquoted_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_unquoted_abbreviation().() |
| 795 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#::Unquotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Unquoted#) |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | /// Parses an unquoted time zone abbreviation. |
| 800 | /// |
| 801 | /// This assumes the parser is position at the first byte in the |
| 802 | /// abbreviation. |
| 803 | /// |
| 804 | /// Upon success, the parser will be positioned immediately after the |
| 805 | /// last byte in the abbreviation. |
| 806 | /// |
| 807 | /// The string returned is guaranteed to be no more than 30 bytes. |
| 808 | /// (This restriction is somewhat arbitrary, but it's so we can put |
| 809 | /// the abbreviation in a fixed capacity array.) |
| 810 | fn parse_unquoted_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_unquoted_abbreviation().( |
| 811 | &self, |
| 812 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#, UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#> { |
| 813 | let start = self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().(); |
| 814 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom# { |
| 815 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().().is_ascii_alphabeticrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii_alphabetic().() { |
| 816 | break; |
| 817 | } |
| 818 | if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#::capacityrust-analyzer cargo jiff 0.2.18 shared/util/array_str/impl#[`ArrayStr<N>`]capacity().() { |
| 819 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#::TooLongrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#TooLong#); |
| 820 | } |
| 821 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 822 | break; |
| 823 | } |
| 824 | } |
| 825 | let end = self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().(); |
| 826 | let abbrev = |
| 827 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&self.tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| { |
| 828 | // NOTE: I believe this error is technically impossible |
| 829 | // since the loop above restricts letters in an |
| 830 | // abbreviation to ASCII. So everything from `start` to |
| 831 | // `end` is ASCII and thus should be UTF-8. But it doesn't |
| 832 | // cost us anything to report an error here in case the |
| 833 | // code above evolves somehow. |
| 834 | UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#::InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#InvalidUtf8# |
| 835 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 836 | if abbrev.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() 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().3 { |
| 837 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#::TooShortrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#TooShort#); |
| 838 | } |
| 839 | // OK because we verified above that the abbreviation |
| 840 | // does not exceed `Abbreviation::capacity`. |
| 841 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#::newrust-analyzer cargo jiff 0.2.18 shared/util/array_str/impl#[`ArrayStr<N>`]new().(abbrev).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()) |
| 842 | } |
| 843 | |
| 844 | /// Parses a quoted time zone abbreviation. |
| 845 | /// |
| 846 | /// This assumes the parser is positioned immediately after the opening |
| 847 | /// `<` quote. That is, at the first byte in the abbreviation. |
| 848 | /// |
| 849 | /// Upon success, the parser will be positioned immediately after the |
| 850 | /// closing `>` quote. |
| 851 | /// |
| 852 | /// The string returned is guaranteed to be no more than 30 bytes. |
| 853 | /// (This restriction is somewhat arbitrary, but it's so we can put |
| 854 | /// the abbreviation in a fixed capacity array.) |
| 855 | fn parse_quoted_abbreviationrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_quoted_abbreviation().( |
| 856 | &self, |
| 857 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#, QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#> { |
| 858 | let start = self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().(); |
| 859 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom# { |
| 860 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().().is_ascii_alphanumericrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii_alphanumeric().() |
| 861 | && self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b'+' |
| 862 | && self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b'-' |
| 863 | { |
| 864 | break; |
| 865 | } |
| 866 | if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#::capacityrust-analyzer cargo jiff 0.2.18 shared/util/array_str/impl#[`ArrayStr<N>`]capacity().() { |
| 867 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::TooLongrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#TooLong#); |
| 868 | } |
| 869 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 870 | break; |
| 871 | } |
| 872 | } |
| 873 | let end = self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().(); |
| 874 | let abbrev = |
| 875 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&self.tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| { |
| 876 | // NOTE: I believe this error is technically impossible |
| 877 | // since the loop above restricts letters in an |
| 878 | // abbreviation to ASCII. So everything from `start` to |
| 879 | // `end` is ASCII and thus should be UTF-8. But it doesn't |
| 880 | // cost us anything to report an error here in case the |
| 881 | // code above evolves somehow. |
| 882 | QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#InvalidUtf8# |
| 883 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 884 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 885 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::UnexpectedEndrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedEnd#); |
| 886 | } |
| 887 | if self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b'>' { |
| 888 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::UnexpectedLastByterust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedLastByte#); |
| 889 | } |
| 890 | self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().(); |
| 891 | if abbrev.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() 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().3 { |
| 892 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::TooShortrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#TooShort#); |
| 893 | } |
| 894 | // OK because we verified above that the abbreviation |
| 895 | // does not exceed `Abbreviation::capacity`. |
| 896 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#::newrust-analyzer cargo jiff 0.2.18 shared/util/array_str/impl#[`ArrayStr<N>`]new().(abbrev).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()) |
| 897 | } |
| 898 | |
| 899 | /// Parse a POSIX time offset. |
| 900 | /// |
| 901 | /// This assumes the parser is positioned at the first byte of the |
| 902 | /// offset. This can either be a digit (for a positive offset) or the |
| 903 | /// sign of the offset (which must be either `-` or `+`). |
| 904 | /// |
| 905 | /// Upon success, the parser will be positioned immediately after the |
| 906 | /// end of the offset. |
| 907 | fn parse_posix_offsetrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_offset().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#, PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#> { |
| 908 | let sign = self.parse_optional_signrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_optional_sign().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(1); |
| 909 | let hour = self.parse_hour_posixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_hour_posix().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 910 | let (mut minute, mut second) = (0, 0); |
| 911 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b':') { |
| 912 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 913 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::IncompleteMinutesrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#IncompleteMinutes#); |
| 914 | } |
| 915 | minute = self.parse_minuterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_minute().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 916 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b':') { |
| 917 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 918 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::IncompleteSecondsrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#IncompleteSeconds#); |
| 919 | } |
| 920 | second = self.parse_secondrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_second().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 921 | } |
| 922 | } |
| 923 | let mut offset = PosixOffsetrust-analyzer cargo jiff 0.2.18 shared/PosixOffset# { secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second.: i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(hour) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().3600 }; |
| 924 | offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(minute) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().60; |
| 925 | offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(second); |
| 926 | // Yes, we flip the sign, because POSIX is backwards. |
| 927 | // For example, `EST5` corresponds to `-05:00`. |
| 928 | offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().sign); |
| 929 | // Must be true because the parsing routines for hours, minutes |
| 930 | // and seconds enforce they are in the ranges -24..=24, 0..=59 |
| 931 | // and 0..=59, respectively. |
| 932 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 933 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().89999 <= offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. && offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. <= 89999, |
| 934 | "POSIX offset seconds {} is out of range", |
| 935 | offset.secondrust-analyzer cargo jiff 0.2.18 shared/PosixOffset#second. |
| 936 | ); |
| 937 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(offset) |
| 938 | } |
| 939 | |
| 940 | /// Parses a POSIX DST transition rule. |
| 941 | /// |
| 942 | /// This assumes the parser is positioned at the first byte in the |
| 943 | /// rule. That is, it comes immediately after the DST abbreviation or |
| 944 | /// its optional offset. |
| 945 | /// |
| 946 | /// Upon success, the parser will be positioned immediately after the |
| 947 | /// DST transition rule. In typical cases, this corresponds to the end |
| 948 | /// of the TZ string. |
| 949 | fn parse_rulerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_rule().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixRulerust-analyzer cargo jiff 0.2.18 shared/PosixRule#, PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#> { |
| 950 | let start = self |
| 951 | .parse_posix_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_datetime().() |
| 952 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#::DateTimeStartrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#DateTimeStart#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 953 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() 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().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b',') || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 954 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#::ExpectedEndrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#ExpectedEnd#); |
| 955 | } |
| 956 | let end = self |
| 957 | .parse_posix_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_datetime().() |
| 958 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#::DateTimeEndrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#DateTimeEnd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 959 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PosixRulerust-analyzer cargo jiff 0.2.18 shared/PosixRule# { startrust-analyzer cargo jiff 0.2.18 shared/PosixRule#start., endrust-analyzer cargo jiff 0.2.18 shared/PosixRule#end. }) |
| 960 | } |
| 961 | |
| 962 | /// Parses a POSIX datetime specification. |
| 963 | /// |
| 964 | /// This assumes the parser is position at the first byte where a |
| 965 | /// datetime specification is expected to occur. |
| 966 | /// |
| 967 | /// Upon success, the parser will be positioned after the datetime |
| 968 | /// specification. This will either be immediately after the date, or |
| 969 | /// if it's present, the time part of the specification. |
| 970 | fn parse_posix_datetimerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_datetime().( |
| 971 | &self, |
| 972 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixDayTimerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#, PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#> { |
| 973 | let mut daytime = PosixDayTimerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime# { |
| 974 | daterust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#date.: self.parse_posix_daterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_date().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 975 | timerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#time.: PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime#::DEFAULTrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTime]DEFAULT., |
| 976 | }; |
| 977 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() 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().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b'/') { |
| 978 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(daytime); |
| 979 | } |
| 980 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 981 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#::ExpectedTimerust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#ExpectedTime#); |
| 982 | } |
| 983 | daytime.timerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#time. = self.parse_posix_timerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_time().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 984 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(daytime) |
| 985 | } |
| 986 | |
| 987 | /// Parses a POSIX date specification. |
| 988 | /// |
| 989 | /// This assumes the parser is positioned at the first byte of the date |
| 990 | /// specification. This can be `J` (for one based Julian day without |
| 991 | /// leap days), `M` (for "weekday of month") or a digit starting the |
| 992 | /// zero based Julian day with leap days. This routine will validate |
| 993 | /// that the position points to one of these possible values. That is, |
| 994 | /// the caller doesn't need to parse the `M` or the `J` or the leading |
| 995 | /// digit. The caller should just call this routine when it *expect* a |
| 996 | /// date specification to follow. |
| 997 | /// |
| 998 | /// Upon success, the parser will be positioned immediately after the |
| 999 | /// date specification. |
| 1000 | fn parse_posix_daterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_date().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#, PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#> { |
| 1001 | match self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() { |
| 1002 | b'J' => { |
| 1003 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1004 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::ExpectedJulianNoLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#ExpectedJulianNoLeap#); |
| 1005 | } |
| 1006 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::JulianOnerust-analyzer cargo jiff 0.2.18 shared/PosixDay#JulianOne#(self.parse_posix_julian_day_no_leaprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_julian_day_no_leap().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 1007 | } |
| 1008 | b'0'..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#b'9' => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::JulianZerorust-analyzer cargo jiff 0.2.18 shared/PosixDay#JulianZero#( |
| 1009 | self.parse_posix_julian_day_with_leaprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_julian_day_with_leap().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 1010 | )), |
| 1011 | b'M' => { |
| 1012 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1013 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::ExpectedMonthWeekWeekdayrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#ExpectedMonthWeekWeekday#); |
| 1014 | } |
| 1015 | let (month, week, weekday) = self.parse_weekday_of_monthrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_weekday_of_month().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1016 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PosixDayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#::WeekdayOfMonthrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth# { monthrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#month., weekrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#week., weekdayrust-analyzer cargo jiff 0.2.18 shared/PosixDay#WeekdayOfMonth#weekday. }) |
| 1017 | } |
| 1018 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::UnexpectedByterust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#UnexpectedByte#), |
| 1019 | } |
| 1020 | } |
| 1021 | |
| 1022 | /// Parses a POSIX Julian day that does not include leap days |
| 1023 | /// (`1 <= n <= 365`). |
| 1024 | /// |
| 1025 | /// This assumes the parser is positioned just after the `J` and at the |
| 1026 | /// first digit of the Julian day. Upon success, the parser will be |
| 1027 | /// positioned immediately following the day number. |
| 1028 | fn parse_posix_julian_day_no_leaprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_julian_day_no_leap().( |
| 1029 | &self, |
| 1030 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i16, PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#> { |
| 1031 | let number = self |
| 1032 | .parse_number_with_upto_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_upto_n_digits().(3) |
| 1033 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1034 | let number = i16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i16][`TryFrom<i32>`]try_from().(number) |
| 1035 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1036 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().365) { |
| 1037 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Range#); |
| 1038 | } |
| 1039 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1040 | } |
| 1041 | |
| 1042 | /// Parses a POSIX Julian day that includes leap days (`0 <= n <= |
| 1043 | /// 365`). |
| 1044 | /// |
| 1045 | /// This assumes the parser is positioned at the first digit of the |
| 1046 | /// Julian day. Upon success, the parser will be positioned immediately |
| 1047 | /// following the day number. |
| 1048 | fn parse_posix_julian_day_with_leaprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_julian_day_with_leap().( |
| 1049 | &self, |
| 1050 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i16, PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#> { |
| 1051 | let number = self |
| 1052 | .parse_number_with_upto_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_upto_n_digits().(3) |
| 1053 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1054 | let number = |
| 1055 | i16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i16][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1056 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().365) { |
| 1057 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Range#); |
| 1058 | } |
| 1059 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1060 | } |
| 1061 | |
| 1062 | /// Parses a POSIX "weekday of month" specification. |
| 1063 | /// |
| 1064 | /// This assumes the parser is positioned just after the `M` byte and |
| 1065 | /// at the first digit of the month. Upon success, the parser will be |
| 1066 | /// positioned immediately following the "weekday of the month" that |
| 1067 | /// was parsed. |
| 1068 | /// |
| 1069 | /// The tuple returned is month (1..=12), week (1..=5) and weekday |
| 1070 | /// (0..=6 with 0=Sunday). |
| 1071 | fn parse_weekday_of_monthrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_weekday_of_month().( |
| 1072 | &self, |
| 1073 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(i8, i8, i8), WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#> { |
| 1074 | let month = self.parse_monthrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_month().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1075 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() 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().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b'.') { |
| 1076 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::ExpectedDotAfterMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDotAfterMonth#); |
| 1077 | } |
| 1078 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1079 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::ExpectedWeekAfterMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedWeekAfterMonth#); |
| 1080 | } |
| 1081 | let week = self.parse_weekrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_week().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1082 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() 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().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b'.') { |
| 1083 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::ExpectedDotAfterWeekrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDotAfterWeek#); |
| 1084 | } |
| 1085 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1086 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::ExpectedDayOfWeekAfterWeekrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDayOfWeekAfterWeek#); |
| 1087 | } |
| 1088 | let weekday = self.parse_weekdayrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_weekday().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1089 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((month, week, weekday)) |
| 1090 | } |
| 1091 | |
| 1092 | /// This parses a POSIX time specification in the format |
| 1093 | /// `[+/-]hh?[:mm[:ss]]`. |
| 1094 | /// |
| 1095 | /// This assumes the parser is positioned at the first `h` (or the |
| 1096 | /// sign, if present). Upon success, the parser will be positioned |
| 1097 | /// immediately following the end of the time specification. |
| 1098 | fn parse_posix_timerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_posix_time().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime#, PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#> { |
| 1099 | let (sign, hour) = if self.ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#ianav3plus. { |
| 1100 | let sign = self.parse_optional_signrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_optional_sign().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(1); |
| 1101 | let hour = self.parse_hour_ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_hour_ianav3plus().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1102 | (sign, hour) |
| 1103 | } else { |
| 1104 | (1, i16::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i16][`From<i8>`]from().(self.parse_hour_posixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_hour_posix().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 1105 | }; |
| 1106 | let (mut minute, mut second) = (0, 0); |
| 1107 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b':') { |
| 1108 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1109 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::IncompleteMinutesrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#IncompleteMinutes#); |
| 1110 | } |
| 1111 | minute = self.parse_minuterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_minute().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1112 | if self.maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b':') { |
| 1113 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1114 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::IncompleteSecondsrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#IncompleteSeconds#); |
| 1115 | } |
| 1116 | second = self.parse_secondrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_second().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1117 | } |
| 1118 | } |
| 1119 | let mut time = PosixTimerust-analyzer cargo jiff 0.2.18 shared/PosixTime# { secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second.: i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i16>`]from().(hour) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().3600 }; |
| 1120 | time.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(minute) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().60; |
| 1121 | time.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(second); |
| 1122 | time.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<i8>`]from().(sign); |
| 1123 | // Must be true because the parsing routines for hours, minutes |
| 1124 | // and seconds enforce they are in the ranges -167..=167, 0..=59 |
| 1125 | // and 0..=59, respectively. |
| 1126 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 1127 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().604799 <= time.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. && time.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. <= 604799, |
| 1128 | "POSIX time seconds {} is out of range", |
| 1129 | time.secondrust-analyzer cargo jiff 0.2.18 shared/PosixTime#second. |
| 1130 | ); |
| 1131 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(time) |
| 1132 | } |
| 1133 | |
| 1134 | /// Parses a month. |
| 1135 | /// |
| 1136 | /// This is expected to be positioned at the first digit. Upon success, |
| 1137 | /// the parser will be positioned after the month (which may contain |
| 1138 | /// two digits). |
| 1139 | fn parse_monthrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_month().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i8, MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#> { |
| 1140 | let number = self |
| 1141 | .parse_number_with_upto_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_upto_n_digits().(2) |
| 1142 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1143 | let number = i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1144 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().12) { |
| 1145 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Range#); |
| 1146 | } |
| 1147 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1148 | } |
| 1149 | |
| 1150 | /// Parses a week-of-month number. |
| 1151 | /// |
| 1152 | /// This is expected to be positioned at the first digit. Upon success, |
| 1153 | /// the parser will be positioned after the week digit. |
| 1154 | fn parse_weekrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_week().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i8, WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#> { |
| 1155 | let number = self |
| 1156 | .parse_number_with_exactly_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_exactly_n_digits().(1) |
| 1157 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1158 | let number = |
| 1159 | i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1160 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().5) { |
| 1161 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Range#); |
| 1162 | } |
| 1163 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1164 | } |
| 1165 | |
| 1166 | /// Parses a weekday number. |
| 1167 | /// |
| 1168 | /// This is expected to be positioned at the first digit. Upon success, |
| 1169 | /// the parser will be positioned after the week digit. |
| 1170 | /// |
| 1171 | /// The weekday returned is guaranteed to be in the range `0..=6`, with |
| 1172 | /// `0` corresponding to Sunday. |
| 1173 | fn parse_weekdayrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_weekday().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i8, WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#> { |
| 1174 | let number = self |
| 1175 | .parse_number_with_exactly_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_exactly_n_digits().(1) |
| 1176 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1177 | let number = i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1178 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().6) { |
| 1179 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Range#); |
| 1180 | } |
| 1181 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1182 | } |
| 1183 | |
| 1184 | /// Parses an hour from a POSIX time specification with the IANA |
| 1185 | /// v3+ extension. That is, the hour may be in the range `0..=167`. |
| 1186 | /// (Callers should parse an optional sign preceding the hour digits |
| 1187 | /// when IANA V3+ parsing is enabled.) |
| 1188 | /// |
| 1189 | /// The hour is allowed to be a single digit (unlike minutes or |
| 1190 | /// seconds). |
| 1191 | /// |
| 1192 | /// This assumes the parser is positioned at the position where the |
| 1193 | /// first hour digit should occur. Upon success, the parser will be |
| 1194 | /// positioned immediately after the last hour digit. |
| 1195 | fn parse_hour_ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_hour_ianav3plus().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i16, HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#> { |
| 1196 | // Callers should only be using this method when IANA v3+ parsing |
| 1197 | // is enabled. |
| 1198 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(self.ianav3plusrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#ianav3plus.); |
| 1199 | let number = self |
| 1200 | .parse_number_with_upto_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_upto_n_digits().(3) |
| 1201 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1202 | let number = |
| 1203 | i16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i16][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1204 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]le().167) { |
| 1205 | // The error message says -167 but the check above uses 0. |
| 1206 | // This is because the caller is responsible for parsing |
| 1207 | // the sign. |
| 1208 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Range#); |
| 1209 | } |
| 1210 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1211 | } |
| 1212 | |
| 1213 | /// Parses an hour from a POSIX time specification, with the allowed |
| 1214 | /// range being `0..=24`. |
| 1215 | /// |
| 1216 | /// The hour is allowed to be a single digit (unlike minutes or |
| 1217 | /// seconds). |
| 1218 | /// |
| 1219 | /// This assumes the parser is positioned at the position where the |
| 1220 | /// first hour digit should occur. Upon success, the parser will be |
| 1221 | /// positioned immediately after the last hour digit. |
| 1222 | fn parse_hour_posixrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_hour_posix().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i8, HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#> { |
| 1223 | let number = self |
| 1224 | .parse_number_with_upto_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_upto_n_digits().(2) |
| 1225 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1226 | let number = |
| 1227 | i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1228 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().24) { |
| 1229 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Range#); |
| 1230 | } |
| 1231 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1232 | } |
| 1233 | |
| 1234 | /// Parses a minute from a POSIX time specification. |
| 1235 | /// |
| 1236 | /// The minute must be exactly two digits. |
| 1237 | /// |
| 1238 | /// This assumes the parser is positioned at the position where the |
| 1239 | /// first minute digit should occur. Upon success, the parser will be |
| 1240 | /// positioned immediately after the second minute digit. |
| 1241 | fn parse_minuterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_minute().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i8, MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#> { |
| 1242 | let number = self |
| 1243 | .parse_number_with_exactly_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_exactly_n_digits().(2) |
| 1244 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1245 | let number = i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1246 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().59) { |
| 1247 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Range#); |
| 1248 | } |
| 1249 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1250 | } |
| 1251 | |
| 1252 | /// Parses a second from a POSIX time specification. |
| 1253 | /// |
| 1254 | /// The second must be exactly two digits. |
| 1255 | /// |
| 1256 | /// This assumes the parser is positioned at the position where the |
| 1257 | /// first second digit should occur. Upon success, the parser will be |
| 1258 | /// positioned immediately after the second second digit. |
| 1259 | fn parse_secondrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_second().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i8, SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#> { |
| 1260 | let number = self |
| 1261 | .parse_number_with_exactly_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_exactly_n_digits().(2) |
| 1262 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#::Parserust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Parse#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1263 | let number = i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i32>`]try_from().(number).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Range#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1264 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().number && number rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]le().59) { |
| 1265 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#::Rangerust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Range#); |
| 1266 | } |
| 1267 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1268 | } |
| 1269 | |
| 1270 | /// Parses a signed 64-bit integer expressed in exactly `n` digits. |
| 1271 | /// |
| 1272 | /// If `n` digits could not be found (or if the `TZ` string ends before |
| 1273 | /// `n` digits could be found), then this returns an error. |
| 1274 | /// |
| 1275 | /// This assumes that `n >= 1` and that the parser is positioned at the |
| 1276 | /// first digit. Upon success, the parser is positioned immediately |
| 1277 | /// after the `n`th digit. |
| 1278 | fn parse_number_with_exactly_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_exactly_n_digits().( |
| 1279 | &self, |
| 1280 | n: usize, |
| 1281 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i32, NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#> { |
| 1282 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(n >= 1, "numbers must have at least 1 digit"); |
| 1283 | let mut number: i32 = 0; |
| 1284 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#n { |
| 1285 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 1286 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::ExpectedLengthrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#ExpectedLength#); |
| 1287 | } |
| 1288 | let byte = self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().(); |
| 1289 | let digit = match byte.checked_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]checked_sub().(b'0') { |
| 1290 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 1291 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::InvalidDigitrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#InvalidDigit#); |
| 1292 | } |
| 1293 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(digit) if digit rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().9 => { |
| 1294 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::InvalidDigitrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#InvalidDigit#); |
| 1295 | } |
| 1296 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(digit) => { |
| 1297 | debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!((0..=9).containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(&digit)); |
| 1298 | i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<u8>`]from().(digit) |
| 1299 | } |
| 1300 | }; |
| 1301 | number = number |
| 1302 | .checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]checked_mul().(10) |
| 1303 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|n| n.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]checked_add().(digit)) |
| 1304 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::TooBigrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#TooBig#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1305 | self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().(); |
| 1306 | } |
| 1307 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1308 | } |
| 1309 | |
| 1310 | /// Parses a signed 64-bit integer expressed with up to `n` digits and |
| 1311 | /// at least 1 digit. |
| 1312 | /// |
| 1313 | /// This assumes that `n >= 1` and that the parser is positioned at the |
| 1314 | /// first digit. Upon success, the parser is position immediately after |
| 1315 | /// the last digit (which can be at most `n`). |
| 1316 | fn parse_number_with_upto_n_digitsrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_number_with_upto_n_digits().( |
| 1317 | &self, |
| 1318 | n: usize, |
| 1319 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<i32, NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#> { |
| 1320 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(n >= 1, "numbers must have at least 1 digit"); |
| 1321 | let mut number: i32 = 0; |
| 1322 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#n { |
| 1323 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().().is_ascii_digitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii_digit().() { |
| 1324 | if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { |
| 1325 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::Emptyrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#Empty#); |
| 1326 | } |
| 1327 | break; |
| 1328 | } |
| 1329 | let digit = i32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`From<u8>`]from().(self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().b'0'); |
| 1330 | number = number |
| 1331 | .checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]checked_mul().(10) |
| 1332 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|n| n.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]checked_add().(digit)) |
| 1333 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::TooBigrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#TooBig#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1334 | self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().(); |
| 1335 | } |
| 1336 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(number) |
| 1337 | } |
| 1338 | |
| 1339 | /// Parses an optional sign. |
| 1340 | /// |
| 1341 | /// This assumes the parser is positioned at the position where a |
| 1342 | /// positive or negative sign is permitted. If one exists, then it |
| 1343 | /// is consumed and returned. Moreover, if one exists, then this |
| 1344 | /// guarantees that it is not the last byte in the input. That is, upon |
| 1345 | /// success, it is valid to call `self.byte()`. |
| 1346 | fn parse_optional_signrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]parse_optional_sign().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<i8>, OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#> { |
| 1347 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 1348 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1349 | } |
| 1350 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match self.byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().() { |
| 1351 | b'-' => { |
| 1352 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1353 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#::ExpectedDigitAfterMinusrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#ExpectedDigitAfterMinus#); |
| 1354 | } |
| 1355 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1) |
| 1356 | } |
| 1357 | b'+' => { |
| 1358 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().() { |
| 1359 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#::ExpectedDigitAfterPlusrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#ExpectedDigitAfterPlus#); |
| 1360 | } |
| 1361 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1) |
| 1362 | } |
| 1363 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1364 | }) |
| 1365 | } |
| 1366 | } |
| 1367 | |
| 1368 | /// Helper routines for parsing a POSIX `TZ` string. |
| 1369 | impl<'s> Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#<'s> { |
| 1370 | /// Bump the parser to the next byte. |
| 1371 | /// |
| 1372 | /// If the end of the input has been reached, then `false` is returned. |
| 1373 | fn bumprust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]bump().(&self) -> bool { |
| 1374 | if self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() { |
| 1375 | return false; |
| 1376 | } |
| 1377 | self.posrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#pos..setrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`Cell<T>`]set().( |
| 1378 | self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().().checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(1).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("pos cannot overflow usize"), |
| 1379 | ); |
| 1380 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().() |
| 1381 | } |
| 1382 | |
| 1383 | /// Returns true if the next call to `bump` would return false. |
| 1384 | fn is_donerust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]is_done().(&self) -> bool { |
| 1385 | self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().self.tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() |
| 1386 | } |
| 1387 | |
| 1388 | /// Return the byte at the current position of the parser. |
| 1389 | /// |
| 1390 | /// This panics if the parser is positioned at the end of the TZ |
| 1391 | /// string. |
| 1392 | fn byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]byte().(&self) -> u8 { |
| 1393 | self.tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 1394 | } |
| 1395 | |
| 1396 | /// Return the byte at the current position of the parser. If the TZ |
| 1397 | /// string has been exhausted, then this returns `None`. |
| 1398 | fn maybe_byterust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]maybe_byte().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u8> { |
| 1399 | self.tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().()).copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]copied().() |
| 1400 | } |
| 1401 | |
| 1402 | /// Return the current byte offset of the parser. |
| 1403 | /// |
| 1404 | /// The offset starts at `0` from the beginning of the TZ string. |
| 1405 | fn posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().(&self) -> usize { |
| 1406 | self.posrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#pos..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/impl#[`Cell<T>`]get().() |
| 1407 | } |
| 1408 | |
| 1409 | /// Returns the remaining bytes of the TZ string. |
| 1410 | /// |
| 1411 | /// This includes `self.byte()`. It may be empty. |
| 1412 | fn remainingrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]remaining().(&self) -> &'s [u8] { |
| 1413 | &self.tzrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#tz.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.posrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`Parser<'s>`]pos().()..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(). |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1418 | pub struct PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError# { |
| 1419 | kindrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#kind.: ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#, |
| 1420 | } |
| 1421 | |
| 1422 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1423 | enum ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind# { |
| 1424 | AbbreviationDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#AbbreviationDst#(AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#), |
| 1425 | AbbreviationStdrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#AbbreviationStd#(AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#), |
| 1426 | Emptyrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#Empty#, |
| 1427 | ExpectedCommaAfterDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#ExpectedCommaAfterDst#, |
| 1428 | FoundDstNoRulerust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundDstNoRule#, |
| 1429 | FoundDstNoRuleWithOffsetrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundDstNoRuleWithOffset#, |
| 1430 | FoundEndAfterCommarust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundEndAfterComma#, |
| 1431 | FoundRemainingrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundRemaining#, |
| 1432 | OffsetDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#OffsetDst#(PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#), |
| 1433 | OffsetStdrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#OffsetStd#(PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#), |
| 1434 | Rulerust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#Rule#(PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#), |
| 1435 | } |
| 1436 | |
| 1437 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError# { |
| 1438 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeZoneError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1439 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#::*; |
| 1440 | match self.kindrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#kind. { |
| 1441 | AbbreviationDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#AbbreviationDst#(ref err) => { |
| 1442 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse DST time zone abbreviation: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1443 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[AbbreviationError][Display]fmt().(err, f) |
| 1444 | } |
| 1445 | AbbreviationStdrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#AbbreviationStd#(ref err) => { |
| 1446 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1447 | "failed to parse standard time zone abbreviation: ", |
| 1448 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1449 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[AbbreviationError][Display]fmt().(err, f) |
| 1450 | } |
| 1451 | Emptyrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#Empty# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1452 | "an empty string is not a valid POSIX time zone \ |
| 1453 | transition rule", |
| 1454 | ), |
| 1455 | ExpectedCommaAfterDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#ExpectedCommaAfterDst# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1456 | "expected `,` after parsing DST offset \ |
| 1457 | in POSIX time zone string", |
| 1458 | ), |
| 1459 | FoundDstNoRulerust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundDstNoRule# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1460 | "found DST abbreviation in POSIX time zone string, \ |
| 1461 | but no transition rule \ |
| 1462 | (this is technically allowed by POSIX, but has \ |
| 1463 | unspecified behavior)", |
| 1464 | ), |
| 1465 | FoundDstNoRuleWithOffsetrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundDstNoRuleWithOffset# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1466 | "found DST abbreviation and offset in POSIX time zone string, \ |
| 1467 | but no transition rule \ |
| 1468 | (this is technically allowed by POSIX, but has \ |
| 1469 | unspecified behavior)", |
| 1470 | ), |
| 1471 | FoundEndAfterCommarust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundEndAfterComma# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1472 | "after parsing DST offset in POSIX time zone string, \ |
| 1473 | found end of string after a trailing `,`", |
| 1474 | ), |
| 1475 | FoundRemainingrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#FoundRemaining# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1476 | "expected entire POSIX TZ string to be a valid \ |
| 1477 | time zone transition rule, but found data after \ |
| 1478 | parsing a valid time zone transition rule", |
| 1479 | ), |
| 1480 | OffsetDstrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#OffsetDst#(ref err) => { |
| 1481 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse DST offset: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1482 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][Display]fmt().(err, f) |
| 1483 | } |
| 1484 | OffsetStdrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#OffsetStd#(ref err) => { |
| 1485 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse standard offset: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1486 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][Display]fmt().(err, f) |
| 1487 | } |
| 1488 | Rulerust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#Rule#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixRuleError][Display]fmt().(err, f), |
| 1489 | } |
| 1490 | } |
| 1491 | } |
| 1492 | |
| 1493 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#> for PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError# { |
| 1494 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeZoneError][`From<ErrorKind>`]from().(kind: ErrorKindrust-analyzer cargo jiff 0.2.18 shared/posix/ErrorKind#) -> PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError# { |
| 1495 | PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError# { kindrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#kind. } |
| 1496 | } |
| 1497 | } |
| 1498 | |
| 1499 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1500 | enum PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1501 | HourPosixrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#HourPosix#(HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#), |
| 1502 | IncompleteMinutesrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#IncompleteMinutes#, |
| 1503 | IncompleteSecondsrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#IncompleteSeconds#, |
| 1504 | Minuterust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#Minute#(MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#), |
| 1505 | OptionalSignrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#OptionalSign#(OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#), |
| 1506 | Secondrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#Second#(SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#), |
| 1507 | } |
| 1508 | |
| 1509 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1510 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1511 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::*; |
| 1512 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1513 | HourPosixrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#HourPosix#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[HourPosixError][Display]fmt().(err, f), |
| 1514 | IncompleteMinutesrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#IncompleteMinutes# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1515 | "incomplete time in \ |
| 1516 | POSIX time zone string (missing minutes)", |
| 1517 | ), |
| 1518 | IncompleteSecondsrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#IncompleteSeconds# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1519 | "incomplete time in \ |
| 1520 | POSIX time zone string (missing seconds)", |
| 1521 | ), |
| 1522 | Minuterust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#Minute#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[MinuteError][Display]fmt().(err, f), |
| 1523 | Secondrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#Second#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[SecondError][Display]fmt().(err, f), |
| 1524 | OptionalSignrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#OptionalSign#(ref err) => { |
| 1525 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1526 | "failed to parse sign for time offset \ |
| 1527 | POSIX time zone string", |
| 1528 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1529 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[OptionalSignError][Display]fmt().(err, f) |
| 1530 | } |
| 1531 | } |
| 1532 | } |
| 1533 | } |
| 1534 | |
| 1535 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#> for PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1536 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][`From<HourPosixError>`]from().(err: HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#) -> PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1537 | PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::HourPosixrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#HourPosix#(err) |
| 1538 | } |
| 1539 | } |
| 1540 | |
| 1541 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#> for PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1542 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][`From<MinuteError>`]from().(err: MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#) -> PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1543 | PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::Minuterust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#Minute#(err) |
| 1544 | } |
| 1545 | } |
| 1546 | |
| 1547 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#> for PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1548 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][`From<OptionalSignError>`]from().(err: OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#) -> PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1549 | PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::OptionalSignrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#OptionalSign#(err) |
| 1550 | } |
| 1551 | } |
| 1552 | |
| 1553 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#> for PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1554 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixOffsetError][`From<SecondError>`]from().(err: SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#) -> PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError# { |
| 1555 | PosixOffsetErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#::Secondrust-analyzer cargo jiff 0.2.18 shared/posix/PosixOffsetError#Second#(err) |
| 1556 | } |
| 1557 | } |
| 1558 | |
| 1559 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1560 | enum PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError# { |
| 1561 | DateTimeEndrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#DateTimeEnd#(PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#), |
| 1562 | DateTimeStartrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#DateTimeStart#(PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#), |
| 1563 | ExpectedEndrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#ExpectedEnd#, |
| 1564 | } |
| 1565 | |
| 1566 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError# { |
| 1567 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixRuleError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1568 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixRuleErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#::*; |
| 1569 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1570 | DateTimeEndrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#DateTimeEnd#(ref err) => { |
| 1571 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse end of DST transition rule: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1572 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateTimeError][Display]fmt().(err, f) |
| 1573 | } |
| 1574 | DateTimeStartrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#DateTimeStart#(ref err) => { |
| 1575 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse start of DST transition rule: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1576 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateTimeError][Display]fmt().(err, f) |
| 1577 | } |
| 1578 | ExpectedEndrust-analyzer cargo jiff 0.2.18 shared/posix/PosixRuleError#ExpectedEnd# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1579 | "expected end of DST rule after parsing the start \ |
| 1580 | of the DST rule", |
| 1581 | ), |
| 1582 | } |
| 1583 | } |
| 1584 | } |
| 1585 | |
| 1586 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1587 | enum PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError# { |
| 1588 | Daterust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#Date#(PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#), |
| 1589 | ExpectedTimerust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#ExpectedTime#, |
| 1590 | Timerust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#Time#(PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#), |
| 1591 | } |
| 1592 | |
| 1593 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError# { |
| 1594 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateTimeError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1595 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#::*; |
| 1596 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1597 | Daterust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#Date#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateError][Display]fmt().(err, f), |
| 1598 | ExpectedTimerust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#ExpectedTime# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1599 | "expected time specification after `/` following a date |
| 1600 | specification in a POSIX time zone DST transition rule", |
| 1601 | ), |
| 1602 | Timerust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#Time#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][Display]fmt().(err, f), |
| 1603 | } |
| 1604 | } |
| 1605 | } |
| 1606 | |
| 1607 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#> for PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError# { |
| 1608 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateTimeError][`From<PosixDateError>`]from().(err: PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#) -> PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError# { |
| 1609 | PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#::Daterust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#Date#(err) |
| 1610 | } |
| 1611 | } |
| 1612 | |
| 1613 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#> for PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError# { |
| 1614 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateTimeError][`From<PosixTimeError>`]from().(err: PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#) -> PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError# { |
| 1615 | PosixDateTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#::Timerust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateTimeError#Time#(err) |
| 1616 | } |
| 1617 | } |
| 1618 | |
| 1619 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1620 | enum PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1621 | ExpectedJulianNoLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#ExpectedJulianNoLeap#, |
| 1622 | ExpectedMonthWeekWeekdayrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#ExpectedMonthWeekWeekday#, |
| 1623 | JulianLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#JulianLeap#(PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#), |
| 1624 | JulianNoLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#JulianNoLeap#(PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#), |
| 1625 | UnexpectedByterust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#UnexpectedByte#, |
| 1626 | WeekdayOfMonthrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#WeekdayOfMonth#(WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#), |
| 1627 | } |
| 1628 | |
| 1629 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1630 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1631 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::*; |
| 1632 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1633 | ExpectedJulianNoLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#ExpectedJulianNoLeap# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1634 | "expected one-based Julian day after `J` in date \ |
| 1635 | specification of a POSIX time zone DST \ |
| 1636 | transition rule, but found the end of input", |
| 1637 | ), |
| 1638 | ExpectedMonthWeekWeekdayrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#ExpectedMonthWeekWeekday# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1639 | "expected month-week-weekday after `M` in date \ |
| 1640 | specification of a POSIX time zone DST \ |
| 1641 | transition rule, but found the end of input", |
| 1642 | ), |
| 1643 | JulianLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#JulianLeap#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixJulianLeapError][Display]fmt().(err, f), |
| 1644 | JulianNoLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#JulianNoLeap#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixJulianNoLeapError][Display]fmt().(err, f), |
| 1645 | UnexpectedByterust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#UnexpectedByte# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1646 | "expected `J`, a digit or `M` at the beginning of a date \ |
| 1647 | specification of a POSIX time zone DST transition rule", |
| 1648 | ), |
| 1649 | WeekdayOfMonthrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#WeekdayOfMonth#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayOfMonthError][Display]fmt().(err, f), |
| 1650 | } |
| 1651 | } |
| 1652 | } |
| 1653 | |
| 1654 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#> for PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1655 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateError][`From<PosixJulianLeapError>`]from().(err: PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#) -> PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1656 | PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::JulianLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#JulianLeap#(err) |
| 1657 | } |
| 1658 | } |
| 1659 | |
| 1660 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#> for PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1661 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateError][`From<PosixJulianNoLeapError>`]from().(err: PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#) -> PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1662 | PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::JulianNoLeaprust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#JulianNoLeap#(err) |
| 1663 | } |
| 1664 | } |
| 1665 | |
| 1666 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#> for PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1667 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixDateError][`From<WeekdayOfMonthError>`]from().(err: WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#) -> PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError# { |
| 1668 | PosixDateErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#::WeekdayOfMonthrust-analyzer cargo jiff 0.2.18 shared/posix/PosixDateError#WeekdayOfMonth#(err) |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1673 | enum PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError# { |
| 1674 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 1675 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Range#, |
| 1676 | } |
| 1677 | |
| 1678 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError# { |
| 1679 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixJulianNoLeapError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1680 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixJulianNoLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#::*; |
| 1681 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1682 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Parse#(ref err) => { |
| 1683 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid one-based Julian day digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1684 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 1685 | } |
| 1686 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianNoLeapError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1687 | "parsed one-based Julian day, but it's not in supported \ |
| 1688 | range of `1..=365`", |
| 1689 | ), |
| 1690 | } |
| 1691 | } |
| 1692 | } |
| 1693 | |
| 1694 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1695 | enum PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError# { |
| 1696 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 1697 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Range#, |
| 1698 | } |
| 1699 | |
| 1700 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError# { |
| 1701 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixJulianLeapError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1702 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixJulianLeapErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#::*; |
| 1703 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1704 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Parse#(ref err) => { |
| 1705 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid zero-based Julian day digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1706 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 1707 | } |
| 1708 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/PosixJulianLeapError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1709 | "parsed zero-based Julian day, but it's not in supported \ |
| 1710 | range of `0..=365`", |
| 1711 | ), |
| 1712 | } |
| 1713 | } |
| 1714 | } |
| 1715 | |
| 1716 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1717 | enum AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError# { |
| 1718 | Quotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Quoted#(QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#), |
| 1719 | Unquotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Unquoted#(UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#), |
| 1720 | } |
| 1721 | |
| 1722 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError# { |
| 1723 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[AbbreviationError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1724 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::AbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#::*; |
| 1725 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1726 | Quotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Quoted#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[QuotedAbbreviationError][Display]fmt().(err, f), |
| 1727 | Unquotedrust-analyzer cargo jiff 0.2.18 shared/posix/AbbreviationError#Unquoted#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[UnquotedAbbreviationError][Display]fmt().(err, f), |
| 1728 | } |
| 1729 | } |
| 1730 | } |
| 1731 | |
| 1732 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1733 | enum UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError# { |
| 1734 | InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#InvalidUtf8#, |
| 1735 | TooLongrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#TooLong#, |
| 1736 | TooShortrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#TooShort#, |
| 1737 | } |
| 1738 | |
| 1739 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError# { |
| 1740 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[UnquotedAbbreviationError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1741 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::UnquotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#::*; |
| 1742 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1743 | InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#InvalidUtf8# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1744 | "unquoted time zone abbreviation must be valid UTF-8", |
| 1745 | ), |
| 1746 | TooLongrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#TooLong# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 1747 | f, |
| 1748 | "expected unquoted time zone abbreviation with at most \ |
| 1749 | {} bytes, but found an abbreviation that is longer", |
| 1750 | Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#::capacityrust-analyzer cargo jiff 0.2.18 shared/util/array_str/impl#[`ArrayStr<N>`]capacity().(), |
| 1751 | ), |
| 1752 | TooShortrust-analyzer cargo jiff 0.2.18 shared/posix/UnquotedAbbreviationError#TooShort# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1753 | "expected unquoted time zone abbreviation to have length of \ |
| 1754 | 3 or more bytes, but an abbreviation that is shorter", |
| 1755 | ), |
| 1756 | } |
| 1757 | } |
| 1758 | } |
| 1759 | |
| 1760 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1761 | enum QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError# { |
| 1762 | InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#InvalidUtf8#, |
| 1763 | TooLongrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#TooLong#, |
| 1764 | TooShortrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#TooShort#, |
| 1765 | UnexpectedEndrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedEnd#, |
| 1766 | UnexpectedEndAfterOpeningrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedEndAfterOpening#, |
| 1767 | UnexpectedLastByterust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedLastByte#, |
| 1768 | } |
| 1769 | |
| 1770 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError# { |
| 1771 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[QuotedAbbreviationError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1772 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::QuotedAbbreviationErrorrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#::*; |
| 1773 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1774 | InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#InvalidUtf8# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1775 | "quoted time zone abbreviation must be valid UTF-8", |
| 1776 | ), |
| 1777 | TooLongrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#TooLong# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 1778 | f, |
| 1779 | "expected quoted time zone abbreviation with at most \ |
| 1780 | {} bytes, but found an abbreviation that is longer", |
| 1781 | Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#::capacityrust-analyzer cargo jiff 0.2.18 shared/util/array_str/impl#[`ArrayStr<N>`]capacity().(), |
| 1782 | ), |
| 1783 | TooShortrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#TooShort# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1784 | "expected quoted time zone abbreviation to have length of \ |
| 1785 | 3 or more bytes, but an abbreviation that is shorter", |
| 1786 | ), |
| 1787 | UnexpectedEndrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedEnd# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1788 | "found non-empty quoted time zone abbreviation, but \ |
| 1789 | found end of input before an end-of-quoted abbreviation \ |
| 1790 | `>` character", |
| 1791 | ), |
| 1792 | UnexpectedEndAfterOpeningrust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedEndAfterOpening# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1793 | "found opening `<` quote for time zone abbreviation in \ |
| 1794 | POSIX time zone transition rule, and expected a name \ |
| 1795 | following it, but found the end of input instead", |
| 1796 | ), |
| 1797 | UnexpectedLastByterust-analyzer cargo jiff 0.2.18 shared/posix/QuotedAbbreviationError#UnexpectedLastByte# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1798 | "found non-empty quoted time zone abbreviation, but \ |
| 1799 | found did not find end-of-quoted abbreviation `>` \ |
| 1800 | character", |
| 1801 | ), |
| 1802 | } |
| 1803 | } |
| 1804 | } |
| 1805 | |
| 1806 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1807 | enum WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1808 | ExpectedDayOfWeekAfterWeekrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDayOfWeekAfterWeek#, |
| 1809 | ExpectedDotAfterMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDotAfterMonth#, |
| 1810 | ExpectedDotAfterWeekrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDotAfterWeek#, |
| 1811 | ExpectedWeekAfterMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedWeekAfterMonth#, |
| 1812 | Monthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#Month#(MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#), |
| 1813 | WeekOfMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#WeekOfMonth#(WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#), |
| 1814 | Weekdayrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#Weekday#(WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#), |
| 1815 | } |
| 1816 | |
| 1817 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1818 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayOfMonthError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1819 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::*; |
| 1820 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1821 | ExpectedDayOfWeekAfterWeekrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDayOfWeekAfterWeek# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1822 | "expected day-of-week after week in POSIX time zone rule", |
| 1823 | ), |
| 1824 | ExpectedDotAfterMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDotAfterMonth# => { |
| 1825 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected `.` after month in POSIX time zone rule") |
| 1826 | } |
| 1827 | ExpectedWeekAfterMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedWeekAfterMonth# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1828 | "expected week after month in POSIX time zone rule", |
| 1829 | ), |
| 1830 | ExpectedDotAfterWeekrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#ExpectedDotAfterWeek# => { |
| 1831 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected `.` after week in POSIX time zone rule") |
| 1832 | } |
| 1833 | Monthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#Month#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[MonthError][Display]fmt().(err, f), |
| 1834 | WeekOfMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#WeekOfMonth#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekOfMonthError][Display]fmt().(err, f), |
| 1835 | Weekdayrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#Weekday#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayError][Display]fmt().(err, f), |
| 1836 | } |
| 1837 | } |
| 1838 | } |
| 1839 | |
| 1840 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#> for WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1841 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayOfMonthError][`From<MonthError>`]from().(err: MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#) -> WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1842 | WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::Monthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#Month#(err) |
| 1843 | } |
| 1844 | } |
| 1845 | |
| 1846 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#> for WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1847 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayOfMonthError][`From<WeekOfMonthError>`]from().(err: WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#) -> WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1848 | WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::WeekOfMonthrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#WeekOfMonth#(err) |
| 1849 | } |
| 1850 | } |
| 1851 | |
| 1852 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#> for WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1853 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayOfMonthError][`From<WeekdayError>`]from().(err: WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#) -> WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError# { |
| 1854 | WeekdayOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#::Weekdayrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayOfMonthError#Weekday#(err) |
| 1855 | } |
| 1856 | } |
| 1857 | |
| 1858 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1859 | enum PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1860 | HourIanarust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#HourIana#(HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#), |
| 1861 | HourPosixrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#HourPosix#(HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#), |
| 1862 | IncompleteMinutesrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#IncompleteMinutes#, |
| 1863 | IncompleteSecondsrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#IncompleteSeconds#, |
| 1864 | Minuterust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#Minute#(MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#), |
| 1865 | OptionalSignrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#OptionalSign#(OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#), |
| 1866 | Secondrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#Second#(SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#), |
| 1867 | } |
| 1868 | |
| 1869 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1870 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1871 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::*; |
| 1872 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1873 | HourIanarust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#HourIana#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[HourIanaError][Display]fmt().(err, f), |
| 1874 | HourPosixrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#HourPosix#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[HourPosixError][Display]fmt().(err, f), |
| 1875 | IncompleteMinutesrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#IncompleteMinutes# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1876 | "incomplete time zone transition time in \ |
| 1877 | POSIX time zone string (missing minutes)", |
| 1878 | ), |
| 1879 | IncompleteSecondsrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#IncompleteSeconds# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1880 | "incomplete time zone transition time in \ |
| 1881 | POSIX time zone string (missing seconds)", |
| 1882 | ), |
| 1883 | Minuterust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#Minute#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[MinuteError][Display]fmt().(err, f), |
| 1884 | Secondrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#Second#(ref err) => corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[SecondError][Display]fmt().(err, f), |
| 1885 | OptionalSignrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#OptionalSign#(ref err) => { |
| 1886 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1887 | "failed to parse sign for time zone transition time", |
| 1888 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1889 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[OptionalSignError][Display]fmt().(err, f) |
| 1890 | } |
| 1891 | } |
| 1892 | } |
| 1893 | } |
| 1894 | |
| 1895 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#> for PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1896 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][`From<HourIanaError>`]from().(err: HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#) -> PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1897 | PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::HourIanarust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#HourIana#(err) |
| 1898 | } |
| 1899 | } |
| 1900 | |
| 1901 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#> for PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1902 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][`From<HourPosixError>`]from().(err: HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#) -> PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1903 | PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::HourPosixrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#HourPosix#(err) |
| 1904 | } |
| 1905 | } |
| 1906 | |
| 1907 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#> for PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1908 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][`From<MinuteError>`]from().(err: MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#) -> PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1909 | PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::Minuterust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#Minute#(err) |
| 1910 | } |
| 1911 | } |
| 1912 | |
| 1913 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#> for PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1914 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][`From<OptionalSignError>`]from().(err: OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#) -> PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1915 | PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::OptionalSignrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#OptionalSign#(err) |
| 1916 | } |
| 1917 | } |
| 1918 | |
| 1919 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#> for PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1920 | fn fromrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[PosixTimeError][`From<SecondError>`]from().(err: SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#) -> PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError# { |
| 1921 | PosixTimeErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#::Secondrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeError#Second#(err) |
| 1922 | } |
| 1923 | } |
| 1924 | |
| 1925 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1926 | enum MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError# { |
| 1927 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 1928 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Range#, |
| 1929 | } |
| 1930 | |
| 1931 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError# { |
| 1932 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[MonthError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1933 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::MonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#::*; |
| 1934 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1935 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Parse#(ref err) => { |
| 1936 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid month digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1937 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 1938 | } |
| 1939 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MonthError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1940 | "parsed month, but it's not in supported \ |
| 1941 | range of `1..=12`", |
| 1942 | ), |
| 1943 | } |
| 1944 | } |
| 1945 | } |
| 1946 | |
| 1947 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1948 | enum WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError# { |
| 1949 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 1950 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Range#, |
| 1951 | } |
| 1952 | |
| 1953 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError# { |
| 1954 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekOfMonthError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1955 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::WeekOfMonthErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#::*; |
| 1956 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1957 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Parse#(ref err) => { |
| 1958 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid week-of-month digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1959 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 1960 | } |
| 1961 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekOfMonthError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1962 | "parsed week-of-month, but it's not in supported \ |
| 1963 | range of `1..=5`", |
| 1964 | ), |
| 1965 | } |
| 1966 | } |
| 1967 | } |
| 1968 | |
| 1969 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1970 | enum WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError# { |
| 1971 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 1972 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Range#, |
| 1973 | } |
| 1974 | |
| 1975 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError# { |
| 1976 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[WeekdayError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1977 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::WeekdayErrorrust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#::*; |
| 1978 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1979 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Parse#(ref err) => { |
| 1980 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid weekday digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1981 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 1982 | } |
| 1983 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/WeekdayError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1984 | "parsed weekday, but it's not in supported \ |
| 1985 | range of `0..=6` (with `0` corresponding to Sunday)", |
| 1986 | ), |
| 1987 | } |
| 1988 | } |
| 1989 | } |
| 1990 | |
| 1991 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1992 | enum HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError# { |
| 1993 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 1994 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Range#, |
| 1995 | } |
| 1996 | |
| 1997 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError# { |
| 1998 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[HourIanaError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1999 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::HourIanaErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#::*; |
| 2000 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 2001 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Parse#(ref err) => { |
| 2002 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid hour digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 2003 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 2004 | } |
| 2005 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourIanaError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2006 | "parsed hours, but it's not in supported \ |
| 2007 | range of `-167..=167`", |
| 2008 | ), |
| 2009 | } |
| 2010 | } |
| 2011 | } |
| 2012 | |
| 2013 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 2014 | enum HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError# { |
| 2015 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 2016 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Range#, |
| 2017 | } |
| 2018 | |
| 2019 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError# { |
| 2020 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[HourPosixError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 2021 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::HourPosixErrorrust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#::*; |
| 2022 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 2023 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Parse#(ref err) => { |
| 2024 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid hour digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 2025 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 2026 | } |
| 2027 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/HourPosixError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2028 | "parsed hours, but it's not in supported \ |
| 2029 | range of `0..=24`", |
| 2030 | ), |
| 2031 | } |
| 2032 | } |
| 2033 | } |
| 2034 | |
| 2035 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 2036 | enum MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError# { |
| 2037 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 2038 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Range#, |
| 2039 | } |
| 2040 | |
| 2041 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError# { |
| 2042 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[MinuteError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 2043 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::MinuteErrorrust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#::*; |
| 2044 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 2045 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Parse#(ref err) => { |
| 2046 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid minute digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 2047 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 2048 | } |
| 2049 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/MinuteError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2050 | "parsed minutes, but it's not in supported \ |
| 2051 | range of `0..=59`", |
| 2052 | ), |
| 2053 | } |
| 2054 | } |
| 2055 | } |
| 2056 | |
| 2057 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 2058 | enum SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError# { |
| 2059 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Parse#(NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#), |
| 2060 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Range#, |
| 2061 | } |
| 2062 | |
| 2063 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError# { |
| 2064 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[SecondError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 2065 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::SecondErrorrust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#::*; |
| 2066 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 2067 | Parserust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Parse#(ref err) => { |
| 2068 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid second digits: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 2069 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(err, f) |
| 2070 | } |
| 2071 | Rangerust-analyzer cargo jiff 0.2.18 shared/posix/SecondError#Range# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2072 | "parsed seconds, but it's not in supported \ |
| 2073 | range of `0..=59`", |
| 2074 | ), |
| 2075 | } |
| 2076 | } |
| 2077 | } |
| 2078 | |
| 2079 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 2080 | enum NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError# { |
| 2081 | Emptyrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#Empty#, |
| 2082 | ExpectedLengthrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#ExpectedLength#, |
| 2083 | InvalidDigitrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#InvalidDigit#, |
| 2084 | TooBigrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#TooBig#, |
| 2085 | } |
| 2086 | |
| 2087 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError# { |
| 2088 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[NumberError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 2089 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::NumberErrorrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#::*; |
| 2090 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 2091 | Emptyrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#Empty# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid number, no digits found"), |
| 2092 | ExpectedLengthrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#ExpectedLength# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2093 | "expected a fixed number of digits, \ |
| 2094 | but found incorrect number", |
| 2095 | ), |
| 2096 | InvalidDigitrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#InvalidDigit# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected digit in range `0..=9`"), |
| 2097 | TooBigrust-analyzer cargo jiff 0.2.18 shared/posix/NumberError#TooBig# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2098 | "parsed number too big to fit into a 32-bit signed integer", |
| 2099 | ), |
| 2100 | } |
| 2101 | } |
| 2102 | } |
| 2103 | |
| 2104 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 2105 | enum OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError# { |
| 2106 | ExpectedDigitAfterMinusrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#ExpectedDigitAfterMinus#, |
| 2107 | ExpectedDigitAfterPlusrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#ExpectedDigitAfterPlus#, |
| 2108 | } |
| 2109 | |
| 2110 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError# { |
| 2111 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[OptionalSignError][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 2112 | use selfrust-analyzer cargo jiff 0.2.18 shared/posix/::OptionalSignErrorrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#::*; |
| 2113 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 2114 | ExpectedDigitAfterMinusrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#ExpectedDigitAfterMinus# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2115 | "expected digit after `-` sign, \ |
| 2116 | but got end of input", |
| 2117 | ), |
| 2118 | ExpectedDigitAfterPlusrust-analyzer cargo jiff 0.2.18 shared/posix/OptionalSignError#ExpectedDigitAfterPlus# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 2119 | "expected digit after `+` sign, \ |
| 2120 | but got end of input", |
| 2121 | ), |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | #[cfg(test)] |
| 2127 | mod tests { |
| 2128 | use superrust-analyzer cargo jiff 0.2.18 shared/::*; |
| 2129 | |
| 2130 | fn posix_time_zone( |
| 2131 | input: impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>, |
| 2132 | ) -> PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#> { |
| 2133 | let input = input.as_ref(); |
| 2134 | let tz = PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#::parse(input).unwrap(); |
| 2135 | #[cfg(feature = "alloc")] |
| 2136 | { |
| 2137 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#; |
| 2138 | |
| 2139 | // While we're here, assert that converting the TZ back |
| 2140 | // to a string matches what we got. In the original version |
| 2141 | // of the POSIX TZ parser, we were very meticulous about |
| 2142 | // capturing the exact AST of the time zone. But I've |
| 2143 | // since simplified the data structure considerably such |
| 2144 | // that it is lossy in terms of what was actually parsed |
| 2145 | // (but of course, not lossy in terms of the semantic |
| 2146 | // meaning of the time zone). |
| 2147 | // |
| 2148 | // So to account for this, we serialize to a string and |
| 2149 | // then parse it back. We should get what we started with. |
| 2150 | let reparsed = |
| 2151 | PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#::parse(tz.to_string().as_bytes()).unwrap(); |
| 2152 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz, reparsed); |
| 2153 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz.to_string(), reparsed.to_string()); |
| 2154 | } |
| 2155 | tz |
| 2156 | } |
| 2157 | |
| 2158 | fn parser(s: &str) -> Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#<'_> { |
| 2159 | Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(s.as_bytes()) |
| 2160 | } |
| 2161 | |
| 2162 | fn date(year: i16, month: i8, day: i8) -> IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate# { |
| 2163 | IDaterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate# { year, month, day } |
| 2164 | } |
| 2165 | |
| 2166 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2167 | fn parse() { |
| 2168 | let p = parser("NZST-12NZDT,J60,J300"); |
| 2169 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2170 | p.parse().unwrap(), |
| 2171 | PosixTimeZone { |
| 2172 | std_abbrev: "NZST".into(), |
| 2173 | std_offset: PosixOffset { second: 12 * 60 * 60 }, |
| 2174 | dst: Some(PosixDst { |
| 2175 | abbrev: "NZDT".into(), |
| 2176 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2177 | rule: PosixRule { |
| 2178 | start: PosixDayTime { |
| 2179 | date: PosixDay::JulianOne(60), |
| 2180 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2181 | }, |
| 2182 | end: PosixDayTime { |
| 2183 | date: PosixDay::JulianOne(300), |
| 2184 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2185 | }, |
| 2186 | }, |
| 2187 | }), |
| 2188 | }, |
| 2189 | ); |
| 2190 | |
| 2191 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZST-12NZDT,J60,J300WAT"); |
| 2192 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse().is_err()); |
| 2193 | } |
| 2194 | |
| 2195 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2196 | fn parse_posix_time_zone() { |
| 2197 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZST-12NZDT,M9.5.0,M4.1.0/3"); |
| 2198 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2199 | p.parse_posix_time_zone().unwrap(), |
| 2200 | PosixTimeZone { |
| 2201 | std_abbrev: "NZST".into(), |
| 2202 | std_offset: PosixOffset { second: 12 * 60 * 60 }, |
| 2203 | dst: Some(PosixDst { |
| 2204 | abbrev: "NZDT".into(), |
| 2205 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2206 | rule: PosixRule { |
| 2207 | start: PosixDayTime { |
| 2208 | date: PosixDay::WeekdayOfMonth { |
| 2209 | month: 9, |
| 2210 | week: 5, |
| 2211 | weekday: 0, |
| 2212 | }, |
| 2213 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2214 | }, |
| 2215 | end: PosixDayTime { |
| 2216 | date: PosixDay::WeekdayOfMonth { |
| 2217 | month: 4, |
| 2218 | week: 1, |
| 2219 | weekday: 0, |
| 2220 | }, |
| 2221 | time: PosixTime { second: 3 * 60 * 60 }, |
| 2222 | }, |
| 2223 | }, |
| 2224 | }), |
| 2225 | }, |
| 2226 | ); |
| 2227 | |
| 2228 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZST-12NZDT,M9.5.0,M4.1.0/3WAT"); |
| 2229 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2230 | p.parse_posix_time_zone().unwrap(), |
| 2231 | PosixTimeZone { |
| 2232 | std_abbrev: "NZST".into(), |
| 2233 | std_offset: PosixOffset { second: 12 * 60 * 60 }, |
| 2234 | dst: Some(PosixDst { |
| 2235 | abbrev: "NZDT".into(), |
| 2236 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2237 | rule: PosixRule { |
| 2238 | start: PosixDayTime { |
| 2239 | date: PosixDay::WeekdayOfMonth { |
| 2240 | month: 9, |
| 2241 | week: 5, |
| 2242 | weekday: 0, |
| 2243 | }, |
| 2244 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2245 | }, |
| 2246 | end: PosixDayTime { |
| 2247 | date: PosixDay::WeekdayOfMonth { |
| 2248 | month: 4, |
| 2249 | week: 1, |
| 2250 | weekday: 0, |
| 2251 | }, |
| 2252 | time: PosixTime { second: 3 * 60 * 60 }, |
| 2253 | }, |
| 2254 | }, |
| 2255 | }), |
| 2256 | }, |
| 2257 | ); |
| 2258 | |
| 2259 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZST-12NZDT,J60,J300"); |
| 2260 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2261 | p.parse_posix_time_zone().unwrap(), |
| 2262 | PosixTimeZone { |
| 2263 | std_abbrev: "NZST".into(), |
| 2264 | std_offset: PosixOffset { second: 12 * 60 * 60 }, |
| 2265 | dst: Some(PosixDst { |
| 2266 | abbrev: "NZDT".into(), |
| 2267 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2268 | rule: PosixRule { |
| 2269 | start: PosixDayTime { |
| 2270 | date: PosixDay::JulianOne(60), |
| 2271 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2272 | }, |
| 2273 | end: PosixDayTime { |
| 2274 | date: PosixDay::JulianOne(300), |
| 2275 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2276 | }, |
| 2277 | }, |
| 2278 | }), |
| 2279 | }, |
| 2280 | ); |
| 2281 | |
| 2282 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZST-12NZDT,J60,J300WAT"); |
| 2283 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2284 | p.parse_posix_time_zone().unwrap(), |
| 2285 | PosixTimeZone { |
| 2286 | std_abbrev: "NZST".into(), |
| 2287 | std_offset: PosixOffset { second: 12 * 60 * 60 }, |
| 2288 | dst: Some(PosixDst { |
| 2289 | abbrev: "NZDT".into(), |
| 2290 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2291 | rule: PosixRule { |
| 2292 | start: PosixDayTime { |
| 2293 | date: PosixDay::JulianOne(60), |
| 2294 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2295 | }, |
| 2296 | end: PosixDayTime { |
| 2297 | date: PosixDay::JulianOne(300), |
| 2298 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2299 | }, |
| 2300 | }, |
| 2301 | }), |
| 2302 | }, |
| 2303 | ); |
| 2304 | } |
| 2305 | |
| 2306 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2307 | fn parse_posix_dst() { |
| 2308 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT,M9.5.0,M4.1.0/3"); |
| 2309 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2310 | p.parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }).unwrap(), |
| 2311 | PosixDst { |
| 2312 | abbrev: "NZDT".into(), |
| 2313 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2314 | rule: PosixRule { |
| 2315 | start: PosixDayTime { |
| 2316 | date: PosixDay::WeekdayOfMonth { |
| 2317 | month: 9, |
| 2318 | week: 5, |
| 2319 | weekday: 0, |
| 2320 | }, |
| 2321 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2322 | }, |
| 2323 | end: PosixDayTime { |
| 2324 | date: PosixDay::WeekdayOfMonth { |
| 2325 | month: 4, |
| 2326 | week: 1, |
| 2327 | weekday: 0, |
| 2328 | }, |
| 2329 | time: PosixTime { second: 3 * 60 * 60 }, |
| 2330 | }, |
| 2331 | }, |
| 2332 | }, |
| 2333 | ); |
| 2334 | |
| 2335 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT,J60,J300"); |
| 2336 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2337 | p.parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }).unwrap(), |
| 2338 | PosixDst { |
| 2339 | abbrev: "NZDT".into(), |
| 2340 | offset: PosixOffset { second: 13 * 60 * 60 }, |
| 2341 | rule: PosixRule { |
| 2342 | start: PosixDayTime { |
| 2343 | date: PosixDay::JulianOne(60), |
| 2344 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2345 | }, |
| 2346 | end: PosixDayTime { |
| 2347 | date: PosixDay::JulianOne(300), |
| 2348 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2349 | }, |
| 2350 | }, |
| 2351 | }, |
| 2352 | ); |
| 2353 | |
| 2354 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT-7,J60,J300"); |
| 2355 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2356 | p.parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }).unwrap(), |
| 2357 | PosixDst { |
| 2358 | abbrev: "NZDT".into(), |
| 2359 | offset: PosixOffset { second: 7 * 60 * 60 }, |
| 2360 | rule: PosixRule { |
| 2361 | start: PosixDayTime { |
| 2362 | date: PosixDay::JulianOne(60), |
| 2363 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2364 | }, |
| 2365 | end: PosixDayTime { |
| 2366 | date: PosixDay::JulianOne(300), |
| 2367 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2368 | }, |
| 2369 | }, |
| 2370 | }, |
| 2371 | ); |
| 2372 | |
| 2373 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT+7,J60,J300"); |
| 2374 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2375 | p.parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }).unwrap(), |
| 2376 | PosixDst { |
| 2377 | abbrev: "NZDT".into(), |
| 2378 | offset: PosixOffset { second: -7 * 60 * 60 }, |
| 2379 | rule: PosixRule { |
| 2380 | start: PosixDayTime { |
| 2381 | date: PosixDay::JulianOne(60), |
| 2382 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2383 | }, |
| 2384 | end: PosixDayTime { |
| 2385 | date: PosixDay::JulianOne(300), |
| 2386 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2387 | }, |
| 2388 | }, |
| 2389 | }, |
| 2390 | ); |
| 2391 | |
| 2392 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT7,J60,J300"); |
| 2393 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2394 | p.parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }).unwrap(), |
| 2395 | PosixDst { |
| 2396 | abbrev: "NZDT".into(), |
| 2397 | offset: PosixOffset { second: -7 * 60 * 60 }, |
| 2398 | rule: PosixRule { |
| 2399 | start: PosixDayTime { |
| 2400 | date: PosixDay::JulianOne(60), |
| 2401 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2402 | }, |
| 2403 | end: PosixDayTime { |
| 2404 | date: PosixDay::JulianOne(300), |
| 2405 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2406 | }, |
| 2407 | }, |
| 2408 | }, |
| 2409 | ); |
| 2410 | |
| 2411 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT7,"); |
| 2412 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p |
| 2413 | .parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }) |
| 2414 | .is_err()); |
| 2415 | |
| 2416 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("NZDT7!"); |
| 2417 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p |
| 2418 | .parse_posix_dst(&PosixOffset { second: 12 * 60 * 60 }) |
| 2419 | .is_err()); |
| 2420 | } |
| 2421 | |
| 2422 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2423 | fn parse_abbreviation() { |
| 2424 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC"); |
| 2425 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_abbreviation().unwrap(), "ABC"); |
| 2426 | |
| 2427 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("<ABC>"); |
| 2428 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_abbreviation().unwrap(), "ABC"); |
| 2429 | |
| 2430 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("<+09>"); |
| 2431 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_abbreviation().unwrap(), "+09"); |
| 2432 | |
| 2433 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+09"); |
| 2434 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_abbreviation().is_err()); |
| 2435 | } |
| 2436 | |
| 2437 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2438 | fn parse_unquoted_abbreviation() { |
| 2439 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC"); |
| 2440 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_unquoted_abbreviation().unwrap(), "ABC"); |
| 2441 | |
| 2442 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABCXYZ"); |
| 2443 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_unquoted_abbreviation().unwrap(), "ABCXYZ"); |
| 2444 | |
| 2445 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC123"); |
| 2446 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_unquoted_abbreviation().unwrap(), "ABC"); |
| 2447 | |
| 2448 | let tz = "a".repeat(30); |
| 2449 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(&tz); |
| 2450 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_unquoted_abbreviation().unwrap(), &*tz); |
| 2451 | |
| 2452 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("a"); |
| 2453 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_unquoted_abbreviation().is_err()); |
| 2454 | |
| 2455 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ab"); |
| 2456 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_unquoted_abbreviation().is_err()); |
| 2457 | |
| 2458 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ab1"); |
| 2459 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_unquoted_abbreviation().is_err()); |
| 2460 | |
| 2461 | let tz = "a".repeat(31); |
| 2462 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(&tz); |
| 2463 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_unquoted_abbreviation().is_err()); |
| 2464 | |
| 2465 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(b"ab\xFFcd"); |
| 2466 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_unquoted_abbreviation().is_err()); |
| 2467 | } |
| 2468 | |
| 2469 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2470 | fn parse_quoted_abbreviation() { |
| 2471 | // The inputs look a little funny here, but that's because |
| 2472 | // 'parse_quoted_abbreviation' starts after the opening quote |
| 2473 | // has been parsed. |
| 2474 | |
| 2475 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC>"); |
| 2476 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "ABC"); |
| 2477 | |
| 2478 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABCXYZ>"); |
| 2479 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "ABCXYZ"); |
| 2480 | |
| 2481 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC>123"); |
| 2482 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "ABC"); |
| 2483 | |
| 2484 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC123>"); |
| 2485 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "ABC123"); |
| 2486 | |
| 2487 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ab1>"); |
| 2488 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "ab1"); |
| 2489 | |
| 2490 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+09>"); |
| 2491 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "+09"); |
| 2492 | |
| 2493 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-09>"); |
| 2494 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_quoted_abbreviation().unwrap(), "-09"); |
| 2495 | |
| 2496 | let tz = allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}>", "a".repeat(30)); |
| 2497 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(&tz); |
| 2498 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2499 | p.parse_quoted_abbreviation().unwrap(), |
| 2500 | tz.trim_end_matches(">") |
| 2501 | ); |
| 2502 | |
| 2503 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("a>"); |
| 2504 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_quoted_abbreviation().is_err()); |
| 2505 | |
| 2506 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ab>"); |
| 2507 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_quoted_abbreviation().is_err()); |
| 2508 | |
| 2509 | let tz = allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}>", "a".repeat(31)); |
| 2510 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(&tz); |
| 2511 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_quoted_abbreviation().is_err()); |
| 2512 | |
| 2513 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(b"ab\xFFcd>"); |
| 2514 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_quoted_abbreviation().is_err()); |
| 2515 | |
| 2516 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC"); |
| 2517 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_quoted_abbreviation().is_err()); |
| 2518 | |
| 2519 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("ABC!>"); |
| 2520 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_quoted_abbreviation().is_err()); |
| 2521 | } |
| 2522 | |
| 2523 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2524 | fn parse_posix_offset() { |
| 2525 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5"); |
| 2526 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_offset().unwrap().second, -5 * 60 * 60); |
| 2527 | |
| 2528 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+5"); |
| 2529 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_offset().unwrap().second, -5 * 60 * 60); |
| 2530 | |
| 2531 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-5"); |
| 2532 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_offset().unwrap().second, 5 * 60 * 60); |
| 2533 | |
| 2534 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-12:34:56"); |
| 2535 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2536 | p.parse_posix_offset().unwrap().second, |
| 2537 | 12 * 60 * 60 + 34 * 60 + 56, |
| 2538 | ); |
| 2539 | |
| 2540 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("a"); |
| 2541 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2542 | |
| 2543 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-"); |
| 2544 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2545 | |
| 2546 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+"); |
| 2547 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2548 | |
| 2549 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-a"); |
| 2550 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2551 | |
| 2552 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+a"); |
| 2553 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2554 | |
| 2555 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-25"); |
| 2556 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2557 | |
| 2558 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+25"); |
| 2559 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2560 | |
| 2561 | // This checks that we don't accidentally permit IANA rules for |
| 2562 | // offset parsing. Namely, the IANA tzfile v3+ extension only applies |
| 2563 | // to transition times. But since POSIX says that the "time" for the |
| 2564 | // offset and transition is the same format, it would be an easy |
| 2565 | // implementation mistake to implement the more flexible rule for |
| 2566 | // IANA and have it accidentally also apply to the offset. So we check |
| 2567 | // that it doesn't here. |
| 2568 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("25") }; |
| 2569 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2570 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+25") }; |
| 2571 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2572 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-25") }; |
| 2573 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_offset().is_err()); |
| 2574 | } |
| 2575 | |
| 2576 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2577 | fn parse_rule() { |
| 2578 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M9.5.0,M4.1.0/3"); |
| 2579 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2580 | p.parse_rule().unwrap(), |
| 2581 | PosixRule { |
| 2582 | start: PosixDayTime { |
| 2583 | date: PosixDay::WeekdayOfMonth { |
| 2584 | month: 9, |
| 2585 | week: 5, |
| 2586 | weekday: 0, |
| 2587 | }, |
| 2588 | time: PosixTime { second: 2 * 60 * 60 }, |
| 2589 | }, |
| 2590 | end: PosixDayTime { |
| 2591 | date: PosixDay::WeekdayOfMonth { |
| 2592 | month: 4, |
| 2593 | week: 1, |
| 2594 | weekday: 0, |
| 2595 | }, |
| 2596 | time: PosixTime { second: 3 * 60 * 60 }, |
| 2597 | }, |
| 2598 | }, |
| 2599 | ); |
| 2600 | |
| 2601 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M9.5.0"); |
| 2602 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_rule().is_err()); |
| 2603 | |
| 2604 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(",M9.5.0,M4.1.0/3"); |
| 2605 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_rule().is_err()); |
| 2606 | |
| 2607 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M9.5.0/"); |
| 2608 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_rule().is_err()); |
| 2609 | |
| 2610 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M9.5.0,M4.1.0/"); |
| 2611 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_rule().is_err()); |
| 2612 | } |
| 2613 | |
| 2614 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2615 | fn parse_posix_datetime() { |
| 2616 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("J1"); |
| 2617 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2618 | p.parse_posix_datetime().unwrap(), |
| 2619 | PosixDayTime { |
| 2620 | date: PosixDay::JulianOne(1), |
| 2621 | time: PosixTime { second: 2 * 60 * 60 } |
| 2622 | }, |
| 2623 | ); |
| 2624 | |
| 2625 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("J1/3"); |
| 2626 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2627 | p.parse_posix_datetime().unwrap(), |
| 2628 | PosixDayTime { |
| 2629 | date: PosixDay::JulianOne(1), |
| 2630 | time: PosixTime { second: 3 * 60 * 60 } |
| 2631 | }, |
| 2632 | ); |
| 2633 | |
| 2634 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M4.1.0/3"); |
| 2635 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2636 | p.parse_posix_datetime().unwrap(), |
| 2637 | PosixDayTime { |
| 2638 | date: PosixDay::WeekdayOfMonth { |
| 2639 | month: 4, |
| 2640 | week: 1, |
| 2641 | weekday: 0, |
| 2642 | }, |
| 2643 | time: PosixTime { second: 3 * 60 * 60 }, |
| 2644 | }, |
| 2645 | ); |
| 2646 | |
| 2647 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1/3:45:05"); |
| 2648 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2649 | p.parse_posix_datetime().unwrap(), |
| 2650 | PosixDayTime { |
| 2651 | date: PosixDay::JulianZero(1), |
| 2652 | time: PosixTime { second: 3 * 60 * 60 + 45 * 60 + 5 }, |
| 2653 | }, |
| 2654 | ); |
| 2655 | |
| 2656 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("a"); |
| 2657 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_datetime().is_err()); |
| 2658 | |
| 2659 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("J1/"); |
| 2660 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_datetime().is_err()); |
| 2661 | |
| 2662 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1/"); |
| 2663 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_datetime().is_err()); |
| 2664 | |
| 2665 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M4.1.0/"); |
| 2666 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_datetime().is_err()); |
| 2667 | } |
| 2668 | |
| 2669 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2670 | fn parse_posix_date() { |
| 2671 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("J1"); |
| 2672 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_date().unwrap(), PosixDay::JulianOne(1)); |
| 2673 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("J365"); |
| 2674 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_date().unwrap(), PosixDay::JulianOne(365)); |
| 2675 | |
| 2676 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2677 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_date().unwrap(), PosixDay::JulianZero(0)); |
| 2678 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 2679 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_date().unwrap(), PosixDay::JulianZero(1)); |
| 2680 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("365"); |
| 2681 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_date().unwrap(), PosixDay::JulianZero(365)); |
| 2682 | |
| 2683 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M9.5.0"); |
| 2684 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2685 | p.parse_posix_date().unwrap(), |
| 2686 | PosixDay::WeekdayOfMonth { month: 9, week: 5, weekday: 0 }, |
| 2687 | ); |
| 2688 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M9.5.6"); |
| 2689 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2690 | p.parse_posix_date().unwrap(), |
| 2691 | PosixDay::WeekdayOfMonth { month: 9, week: 5, weekday: 6 }, |
| 2692 | ); |
| 2693 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M09.5.6"); |
| 2694 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2695 | p.parse_posix_date().unwrap(), |
| 2696 | PosixDay::WeekdayOfMonth { month: 9, week: 5, weekday: 6 }, |
| 2697 | ); |
| 2698 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("M12.1.1"); |
| 2699 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2700 | p.parse_posix_date().unwrap(), |
| 2701 | PosixDay::WeekdayOfMonth { month: 12, week: 1, weekday: 1 }, |
| 2702 | ); |
| 2703 | |
| 2704 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("a"); |
| 2705 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_date().is_err()); |
| 2706 | |
| 2707 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("j"); |
| 2708 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_date().is_err()); |
| 2709 | |
| 2710 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("m"); |
| 2711 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_date().is_err()); |
| 2712 | |
| 2713 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("n"); |
| 2714 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_date().is_err()); |
| 2715 | |
| 2716 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("J366"); |
| 2717 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_date().is_err()); |
| 2718 | |
| 2719 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("366"); |
| 2720 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_date().is_err()); |
| 2721 | } |
| 2722 | |
| 2723 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2724 | fn parse_posix_julian_day_no_leap() { |
| 2725 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 2726 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_no_leap().unwrap(), 1); |
| 2727 | |
| 2728 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("001"); |
| 2729 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_no_leap().unwrap(), 1); |
| 2730 | |
| 2731 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("365"); |
| 2732 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_no_leap().unwrap(), 365); |
| 2733 | |
| 2734 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("3655"); |
| 2735 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_no_leap().unwrap(), 365); |
| 2736 | |
| 2737 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2738 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_julian_day_no_leap().is_err()); |
| 2739 | |
| 2740 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("366"); |
| 2741 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_julian_day_no_leap().is_err()); |
| 2742 | } |
| 2743 | |
| 2744 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2745 | fn parse_posix_julian_day_with_leap() { |
| 2746 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2747 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_with_leap().unwrap(), 0); |
| 2748 | |
| 2749 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 2750 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_with_leap().unwrap(), 1); |
| 2751 | |
| 2752 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("001"); |
| 2753 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_with_leap().unwrap(), 1); |
| 2754 | |
| 2755 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("365"); |
| 2756 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_with_leap().unwrap(), 365); |
| 2757 | |
| 2758 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("3655"); |
| 2759 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_julian_day_with_leap().unwrap(), 365); |
| 2760 | |
| 2761 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("366"); |
| 2762 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_julian_day_with_leap().is_err()); |
| 2763 | } |
| 2764 | |
| 2765 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2766 | fn parse_weekday_of_month() { |
| 2767 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.5.0"); |
| 2768 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday_of_month().unwrap(), (9, 5, 0)); |
| 2769 | |
| 2770 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.1.6"); |
| 2771 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday_of_month().unwrap(), (9, 1, 6)); |
| 2772 | |
| 2773 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("09.1.6"); |
| 2774 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday_of_month().unwrap(), (9, 1, 6)); |
| 2775 | |
| 2776 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9"); |
| 2777 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2778 | |
| 2779 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9."); |
| 2780 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2781 | |
| 2782 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.5"); |
| 2783 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2784 | |
| 2785 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.5."); |
| 2786 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2787 | |
| 2788 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0.5.0"); |
| 2789 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2790 | |
| 2791 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("13.5.0"); |
| 2792 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2793 | |
| 2794 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.0.0"); |
| 2795 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2796 | |
| 2797 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.6.0"); |
| 2798 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2799 | |
| 2800 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9.5.7"); |
| 2801 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday_of_month().is_err()); |
| 2802 | } |
| 2803 | |
| 2804 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2805 | fn parse_posix_time() { |
| 2806 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5"); |
| 2807 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_time().unwrap().second, 5 * 60 * 60); |
| 2808 | |
| 2809 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("22"); |
| 2810 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_time().unwrap().second, 22 * 60 * 60); |
| 2811 | |
| 2812 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("02"); |
| 2813 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_posix_time().unwrap().second, 2 * 60 * 60); |
| 2814 | |
| 2815 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5:45"); |
| 2816 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2817 | p.parse_posix_time().unwrap().second, |
| 2818 | 5 * 60 * 60 + 45 * 60 |
| 2819 | ); |
| 2820 | |
| 2821 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5:45:12"); |
| 2822 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2823 | p.parse_posix_time().unwrap().second, |
| 2824 | 5 * 60 * 60 + 45 * 60 + 12 |
| 2825 | ); |
| 2826 | |
| 2827 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5:45:129"); |
| 2828 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2829 | p.parse_posix_time().unwrap().second, |
| 2830 | 5 * 60 * 60 + 45 * 60 + 12 |
| 2831 | ); |
| 2832 | |
| 2833 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5:45:12:"); |
| 2834 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2835 | p.parse_posix_time().unwrap().second, |
| 2836 | 5 * 60 * 60 + 45 * 60 + 12 |
| 2837 | ); |
| 2838 | |
| 2839 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+5:45:12") }; |
| 2840 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2841 | p.parse_posix_time().unwrap().second, |
| 2842 | 5 * 60 * 60 + 45 * 60 + 12 |
| 2843 | ); |
| 2844 | |
| 2845 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-5:45:12") }; |
| 2846 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2847 | p.parse_posix_time().unwrap().second, |
| 2848 | -(5 * 60 * 60 + 45 * 60 + 12) |
| 2849 | ); |
| 2850 | |
| 2851 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-167:45:12") }; |
| 2852 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 2853 | p.parse_posix_time().unwrap().second, |
| 2854 | -(167 * 60 * 60 + 45 * 60 + 12), |
| 2855 | ); |
| 2856 | |
| 2857 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("25"); |
| 2858 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2859 | |
| 2860 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12:2"); |
| 2861 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2862 | |
| 2863 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12:"); |
| 2864 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2865 | |
| 2866 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12:23:5"); |
| 2867 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2868 | |
| 2869 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12:23:"); |
| 2870 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2871 | |
| 2872 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("168") }; |
| 2873 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2874 | |
| 2875 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("-168") }; |
| 2876 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2877 | |
| 2878 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("+168") }; |
| 2879 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_posix_time().is_err()); |
| 2880 | } |
| 2881 | |
| 2882 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2883 | fn parse_month() { |
| 2884 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 2885 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_month().unwrap(), 1); |
| 2886 | |
| 2887 | // Should this be allowed? POSIX spec is unclear. |
| 2888 | // We allow it because our parse does stop at 2 |
| 2889 | // digits, so this seems harmless. Namely, '001' |
| 2890 | // results in an error. |
| 2891 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("01"); |
| 2892 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_month().unwrap(), 1); |
| 2893 | |
| 2894 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12"); |
| 2895 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_month().unwrap(), 12); |
| 2896 | |
| 2897 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2898 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_month().is_err()); |
| 2899 | |
| 2900 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("00"); |
| 2901 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_month().is_err()); |
| 2902 | |
| 2903 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("001"); |
| 2904 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_month().is_err()); |
| 2905 | |
| 2906 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("13"); |
| 2907 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_month().is_err()); |
| 2908 | } |
| 2909 | |
| 2910 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2911 | fn parse_week() { |
| 2912 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 2913 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_week().unwrap(), 1); |
| 2914 | |
| 2915 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5"); |
| 2916 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_week().unwrap(), 5); |
| 2917 | |
| 2918 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("55"); |
| 2919 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_week().unwrap(), 5); |
| 2920 | |
| 2921 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2922 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_week().is_err()); |
| 2923 | |
| 2924 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("6"); |
| 2925 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_week().is_err()); |
| 2926 | |
| 2927 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("00"); |
| 2928 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_week().is_err()); |
| 2929 | |
| 2930 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("01"); |
| 2931 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_week().is_err()); |
| 2932 | |
| 2933 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("05"); |
| 2934 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_week().is_err()); |
| 2935 | } |
| 2936 | |
| 2937 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2938 | fn parse_weekday() { |
| 2939 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2940 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday().unwrap(), 0); |
| 2941 | |
| 2942 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 2943 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday().unwrap(), 1); |
| 2944 | |
| 2945 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("6"); |
| 2946 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday().unwrap(), 6); |
| 2947 | |
| 2948 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("00"); |
| 2949 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday().unwrap(), 0); |
| 2950 | |
| 2951 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("06"); |
| 2952 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday().unwrap(), 0); |
| 2953 | |
| 2954 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("60"); |
| 2955 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_weekday().unwrap(), 6); |
| 2956 | |
| 2957 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("7"); |
| 2958 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_weekday().is_err()); |
| 2959 | } |
| 2960 | |
| 2961 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2962 | fn parse_hour_posix() { |
| 2963 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("5"); |
| 2964 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_posix().unwrap(), 5); |
| 2965 | |
| 2966 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 2967 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_posix().unwrap(), 0); |
| 2968 | |
| 2969 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("00"); |
| 2970 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_posix().unwrap(), 0); |
| 2971 | |
| 2972 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("24"); |
| 2973 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_posix().unwrap(), 24); |
| 2974 | |
| 2975 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("100"); |
| 2976 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_posix().unwrap(), 10); |
| 2977 | |
| 2978 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("25"); |
| 2979 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_hour_posix().is_err()); |
| 2980 | |
| 2981 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("99"); |
| 2982 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_hour_posix().is_err()); |
| 2983 | } |
| 2984 | |
| 2985 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 2986 | fn parse_hour_ianav3plus() { |
| 2987 | let new = |input| Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser# { ianav3plus: true, ..Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(input) }; |
| 2988 | |
| 2989 | let p = new("5"); |
| 2990 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 5); |
| 2991 | |
| 2992 | let p = new("0"); |
| 2993 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 0); |
| 2994 | |
| 2995 | let p = new("00"); |
| 2996 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 0); |
| 2997 | |
| 2998 | let p = new("000"); |
| 2999 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 0); |
| 3000 | |
| 3001 | let p = new("24"); |
| 3002 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 24); |
| 3003 | |
| 3004 | let p = new("100"); |
| 3005 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 100); |
| 3006 | |
| 3007 | let p = new("1000"); |
| 3008 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 100); |
| 3009 | |
| 3010 | let p = new("167"); |
| 3011 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_hour_ianav3plus().unwrap(), 167); |
| 3012 | |
| 3013 | let p = new("168"); |
| 3014 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_hour_ianav3plus().is_err()); |
| 3015 | |
| 3016 | let p = new("999"); |
| 3017 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_hour_ianav3plus().is_err()); |
| 3018 | } |
| 3019 | |
| 3020 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3021 | fn parse_minute() { |
| 3022 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("00"); |
| 3023 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_minute().unwrap(), 0); |
| 3024 | |
| 3025 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("24"); |
| 3026 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_minute().unwrap(), 24); |
| 3027 | |
| 3028 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("59"); |
| 3029 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_minute().unwrap(), 59); |
| 3030 | |
| 3031 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("599"); |
| 3032 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_minute().unwrap(), 59); |
| 3033 | |
| 3034 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 3035 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_minute().is_err()); |
| 3036 | |
| 3037 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 3038 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_minute().is_err()); |
| 3039 | |
| 3040 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9"); |
| 3041 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_minute().is_err()); |
| 3042 | |
| 3043 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("60"); |
| 3044 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_minute().is_err()); |
| 3045 | } |
| 3046 | |
| 3047 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3048 | fn parse_second() { |
| 3049 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("00"); |
| 3050 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_second().unwrap(), 0); |
| 3051 | |
| 3052 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("24"); |
| 3053 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_second().unwrap(), 24); |
| 3054 | |
| 3055 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("59"); |
| 3056 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_second().unwrap(), 59); |
| 3057 | |
| 3058 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("599"); |
| 3059 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_second().unwrap(), 59); |
| 3060 | |
| 3061 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("0"); |
| 3062 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_second().is_err()); |
| 3063 | |
| 3064 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 3065 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_second().is_err()); |
| 3066 | |
| 3067 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("9"); |
| 3068 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_second().is_err()); |
| 3069 | |
| 3070 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("60"); |
| 3071 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_second().is_err()); |
| 3072 | } |
| 3073 | |
| 3074 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3075 | fn parse_number_with_exactly_n_digits() { |
| 3076 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 3077 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_exactly_n_digits(1).unwrap(), 1); |
| 3078 | |
| 3079 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12"); |
| 3080 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_exactly_n_digits(2).unwrap(), 12); |
| 3081 | |
| 3082 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("123"); |
| 3083 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_exactly_n_digits(2).unwrap(), 12); |
| 3084 | |
| 3085 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(""); |
| 3086 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_number_with_exactly_n_digits(1).is_err()); |
| 3087 | |
| 3088 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 3089 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_number_with_exactly_n_digits(2).is_err()); |
| 3090 | |
| 3091 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12"); |
| 3092 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_number_with_exactly_n_digits(3).is_err()); |
| 3093 | } |
| 3094 | |
| 3095 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3096 | fn parse_number_with_upto_n_digits() { |
| 3097 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 3098 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_upto_n_digits(1).unwrap(), 1); |
| 3099 | |
| 3100 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("1"); |
| 3101 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_upto_n_digits(2).unwrap(), 1); |
| 3102 | |
| 3103 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12"); |
| 3104 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_upto_n_digits(2).unwrap(), 12); |
| 3105 | |
| 3106 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("12"); |
| 3107 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_upto_n_digits(3).unwrap(), 12); |
| 3108 | |
| 3109 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("123"); |
| 3110 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p.parse_number_with_upto_n_digits(2).unwrap(), 12); |
| 3111 | |
| 3112 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new(""); |
| 3113 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_number_with_upto_n_digits(1).is_err()); |
| 3114 | |
| 3115 | let p = Parserrust-analyzer cargo jiff 0.2.18 shared/posix/Parser#::new("a"); |
| 3116 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(p.parse_number_with_upto_n_digits(1).is_err()); |
| 3117 | } |
| 3118 | |
| 3119 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3120 | fn to_dst_civil_datetime_utc_range() { |
| 3121 | let tz = posix_time_zone("WART4WARST,J1/-3,J365/20"); |
| 3122 | let dst_info = DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo# { |
| 3123 | // We test this in other places. It's too annoying to write this |
| 3124 | // out here, and I didn't adopt snapshot testing until I had |
| 3125 | // written out these tests by hand. ¯\_(ツ)_/¯ |
| 3126 | dst: tz.dst.as_ref().unwrap(), |
| 3127 | start: date(2024, 1, 1).at(1, 0, 0, 0), |
| 3128 | end: date(2024, 12, 31).at(23, 0, 0, 0), |
| 3129 | }; |
| 3130 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz.dst_info_utc(2024), Some(dst_info)); |
| 3131 | |
| 3132 | let tz = posix_time_zone("WART4WARST,J1/-4,J365/21"); |
| 3133 | let dst_info = DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo# { |
| 3134 | dst: tz.dst.as_ref().unwrap(), |
| 3135 | start: date(2024, 1, 1).at(0, 0, 0, 0), |
| 3136 | end: date(2024, 12, 31).at(23, 59, 59, 999_999_999), |
| 3137 | }; |
| 3138 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz.dst_info_utc(2024), Some(dst_info)); |
| 3139 | |
| 3140 | let tz = posix_time_zone("EST5EDT,M3.2.0,M11.1.0"); |
| 3141 | let dst_info = DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo# { |
| 3142 | dst: tz.dst.as_ref().unwrap(), |
| 3143 | start: date(2024, 3, 10).at(7, 0, 0, 0), |
| 3144 | end: date(2024, 11, 3).at(6, 0, 0, 0), |
| 3145 | }; |
| 3146 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz.dst_info_utc(2024), Some(dst_info)); |
| 3147 | } |
| 3148 | |
| 3149 | // See: https://github.com/BurntSushi/jiff/issues/386 |
| 3150 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3151 | fn regression_permanent_dst() { |
| 3152 | let tz = posix_time_zone("XXX-2<+01>-1,0/0,J365/23"); |
| 3153 | let dst_info = DstInforust-analyzer cargo jiff 0.2.18 shared/posix/DstInfo# { |
| 3154 | dst: tz.dst.as_ref().unwrap(), |
| 3155 | start: date(2087, 1, 1).at(0, 0, 0, 0), |
| 3156 | end: date(2087, 12, 31).at(23, 59, 59, 999_999_999), |
| 3157 | }; |
| 3158 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz.dst_info_utc(2087), Some(dst_info)); |
| 3159 | } |
| 3160 | |
| 3161 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3162 | fn reasonable() { |
| 3163 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(b"EST5").is_ok()); |
| 3164 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(b"EST5EDT").is_err()); |
| 3165 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(b"EST5EDT,J1,J365").is_ok()); |
| 3166 | |
| 3167 | let tz = posix_time_zone("EST24EDT,J1,J365"); |
| 3168 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3169 | tz, |
| 3170 | PosixTimeZone { |
| 3171 | std_abbrev: "EST".into(), |
| 3172 | std_offset: PosixOffset { second: -24 * 60 * 60 }, |
| 3173 | dst: Some(PosixDst { |
| 3174 | abbrev: "EDT".into(), |
| 3175 | offset: PosixOffset { second: -23 * 60 * 60 }, |
| 3176 | rule: PosixRule { |
| 3177 | start: PosixDayTime { |
| 3178 | date: PosixDay::JulianOne(1), |
| 3179 | time: PosixTime::DEFAULT, |
| 3180 | }, |
| 3181 | end: PosixDayTime { |
| 3182 | date: PosixDay::JulianOne(365), |
| 3183 | time: PosixTime::DEFAULT, |
| 3184 | }, |
| 3185 | }, |
| 3186 | }), |
| 3187 | }, |
| 3188 | ); |
| 3189 | |
| 3190 | let tz = posix_time_zone("EST-24EDT,J1,J365"); |
| 3191 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3192 | tz, |
| 3193 | PosixTimeZone { |
| 3194 | std_abbrev: "EST".into(), |
| 3195 | std_offset: PosixOffset { second: 24 * 60 * 60 }, |
| 3196 | dst: Some(PosixDst { |
| 3197 | abbrev: "EDT".into(), |
| 3198 | offset: PosixOffset { second: 25 * 60 * 60 }, |
| 3199 | rule: PosixRule { |
| 3200 | start: PosixDayTime { |
| 3201 | date: PosixDay::JulianOne(1), |
| 3202 | time: PosixTime::DEFAULT, |
| 3203 | }, |
| 3204 | end: PosixDayTime { |
| 3205 | date: PosixDay::JulianOne(365), |
| 3206 | time: PosixTime::DEFAULT, |
| 3207 | }, |
| 3208 | }, |
| 3209 | }), |
| 3210 | }, |
| 3211 | ); |
| 3212 | } |
| 3213 | |
| 3214 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3215 | fn posix_date_time_spec_to_datetime() { |
| 3216 | // For this test, we just keep the offset to zero to simplify things |
| 3217 | // a bit. We get coverage for non-zero offsets in higher level tests. |
| 3218 | let to_datetime = |daytime: &PosixDayTimerust-analyzer cargo jiff 0.2.18 shared/PosixDayTime#, year: i16| { |
| 3219 | daytime.to_datetime(year, IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#::UTC) |
| 3220 | }; |
| 3221 | |
| 3222 | let tz = posix_time_zone("EST5EDT,J1,J365/5:12:34"); |
| 3223 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3224 | to_datetime(&tz.rule().start, 2023), |
| 3225 | date(2023, 1, 1).at(2, 0, 0, 0), |
| 3226 | ); |
| 3227 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3228 | to_datetime(&tz.rule().end, 2023), |
| 3229 | date(2023, 12, 31).at(5, 12, 34, 0), |
| 3230 | ); |
| 3231 | |
| 3232 | let tz = posix_time_zone("EST+5EDT,M3.2.0/2,M11.1.0/2"); |
| 3233 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3234 | to_datetime(&tz.rule().start, 2024), |
| 3235 | date(2024, 3, 10).at(2, 0, 0, 0), |
| 3236 | ); |
| 3237 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3238 | to_datetime(&tz.rule().end, 2024), |
| 3239 | date(2024, 11, 3).at(2, 0, 0, 0), |
| 3240 | ); |
| 3241 | |
| 3242 | let tz = posix_time_zone("EST+5EDT,M1.1.1,M12.5.2"); |
| 3243 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3244 | to_datetime(&tz.rule().start, 2024), |
| 3245 | date(2024, 1, 1).at(2, 0, 0, 0), |
| 3246 | ); |
| 3247 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3248 | to_datetime(&tz.rule().end, 2024), |
| 3249 | date(2024, 12, 31).at(2, 0, 0, 0), |
| 3250 | ); |
| 3251 | |
| 3252 | let tz = posix_time_zone("EST5EDT,0/0,J365/25"); |
| 3253 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3254 | to_datetime(&tz.rule().start, 2024), |
| 3255 | date(2024, 1, 1).at(0, 0, 0, 0), |
| 3256 | ); |
| 3257 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3258 | to_datetime(&tz.rule().end, 2024), |
| 3259 | date(2024, 12, 31).at(23, 59, 59, 999_999_999), |
| 3260 | ); |
| 3261 | |
| 3262 | let tz = posix_time_zone("XXX3EDT4,0/0,J365/23"); |
| 3263 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3264 | to_datetime(&tz.rule().start, 2024), |
| 3265 | date(2024, 1, 1).at(0, 0, 0, 0), |
| 3266 | ); |
| 3267 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3268 | to_datetime(&tz.rule().end, 2024), |
| 3269 | date(2024, 12, 31).at(23, 0, 0, 0), |
| 3270 | ); |
| 3271 | |
| 3272 | let tz = posix_time_zone("XXX3EDT4,0/0,365"); |
| 3273 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3274 | to_datetime(&tz.rule().end, 2023), |
| 3275 | date(2023, 12, 31).at(23, 59, 59, 999_999_999), |
| 3276 | ); |
| 3277 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3278 | to_datetime(&tz.rule().end, 2024), |
| 3279 | date(2024, 12, 31).at(2, 0, 0, 0), |
| 3280 | ); |
| 3281 | |
| 3282 | let tz = posix_time_zone("XXX3EDT4,J1/-167:59:59,J365/167:59:59"); |
| 3283 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3284 | to_datetime(&tz.rule().start, 2024), |
| 3285 | date(2024, 1, 1).at(0, 0, 0, 0), |
| 3286 | ); |
| 3287 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3288 | to_datetime(&tz.rule().end, 2024), |
| 3289 | date(2024, 12, 31).at(23, 59, 59, 999_999_999), |
| 3290 | ); |
| 3291 | } |
| 3292 | |
| 3293 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3294 | fn posix_date_time_spec_time() { |
| 3295 | let tz = posix_time_zone("EST5EDT,J1,J365/5:12:34"); |
| 3296 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(tz.rule().start.time, PosixTime::DEFAULT); |
| 3297 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3298 | tz.rule().end.time, |
| 3299 | PosixTime { second: 5 * 60 * 60 + 12 * 60 + 34 }, |
| 3300 | ); |
| 3301 | } |
| 3302 | |
| 3303 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3304 | fn posix_date_spec_to_date() { |
| 3305 | let tz = posix_time_zone("EST+5EDT,M3.2.0/2,M11.1.0/2"); |
| 3306 | let start = tz.rule().start.date.to_date(2023); |
| 3307 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2023, 3, 12))); |
| 3308 | let end = tz.rule().end.date.to_date(2023); |
| 3309 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, Some(date(2023, 11, 5))); |
| 3310 | let start = tz.rule().start.date.to_date(2024); |
| 3311 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2024, 3, 10))); |
| 3312 | let end = tz.rule().end.date.to_date(2024); |
| 3313 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, Some(date(2024, 11, 3))); |
| 3314 | |
| 3315 | let tz = posix_time_zone("EST+5EDT,J60,J365"); |
| 3316 | let start = tz.rule().start.date.to_date(2023); |
| 3317 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2023, 3, 1))); |
| 3318 | let end = tz.rule().end.date.to_date(2023); |
| 3319 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, Some(date(2023, 12, 31))); |
| 3320 | let start = tz.rule().start.date.to_date(2024); |
| 3321 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2024, 3, 1))); |
| 3322 | let end = tz.rule().end.date.to_date(2024); |
| 3323 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, Some(date(2024, 12, 31))); |
| 3324 | |
| 3325 | let tz = posix_time_zone("EST+5EDT,59,365"); |
| 3326 | let start = tz.rule().start.date.to_date(2023); |
| 3327 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2023, 3, 1))); |
| 3328 | let end = tz.rule().end.date.to_date(2023); |
| 3329 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, None); |
| 3330 | let start = tz.rule().start.date.to_date(2024); |
| 3331 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2024, 2, 29))); |
| 3332 | let end = tz.rule().end.date.to_date(2024); |
| 3333 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, Some(date(2024, 12, 31))); |
| 3334 | |
| 3335 | let tz = posix_time_zone("EST+5EDT,M1.1.1,M12.5.2"); |
| 3336 | let start = tz.rule().start.date.to_date(2024); |
| 3337 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(start, Some(date(2024, 1, 1))); |
| 3338 | let end = tz.rule().end.date.to_date(2024); |
| 3339 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(end, Some(date(2024, 12, 31))); |
| 3340 | } |
| 3341 | |
| 3342 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3343 | fn posix_time_spec_to_civil_time() { |
| 3344 | let tz = posix_time_zone("EST5EDT,J1,J365/5:12:34"); |
| 3345 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3346 | tz.dst.as_ref().unwrap().rule.start.time.second, |
| 3347 | 2 * 60 * 60, |
| 3348 | ); |
| 3349 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3350 | tz.dst.as_ref().unwrap().rule.end.time.second, |
| 3351 | 5 * 60 * 60 + 12 * 60 + 34, |
| 3352 | ); |
| 3353 | |
| 3354 | let tz = posix_time_zone("EST5EDT,J1/23:59:59,J365/24:00:00"); |
| 3355 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3356 | tz.dst.as_ref().unwrap().rule.start.time.second, |
| 3357 | 23 * 60 * 60 + 59 * 60 + 59, |
| 3358 | ); |
| 3359 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3360 | tz.dst.as_ref().unwrap().rule.end.time.second, |
| 3361 | 24 * 60 * 60, |
| 3362 | ); |
| 3363 | |
| 3364 | let tz = posix_time_zone("EST5EDT,J1/-1,J365/167:00:00"); |
| 3365 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3366 | tz.dst.as_ref().unwrap().rule.start.time.second, |
| 3367 | -1 * 60 * 60, |
| 3368 | ); |
| 3369 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3370 | tz.dst.as_ref().unwrap().rule.end.time.second, |
| 3371 | 167 * 60 * 60, |
| 3372 | ); |
| 3373 | } |
| 3374 | |
| 3375 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3376 | fn parse_iana() { |
| 3377 | // Ref: https://github.com/chronotope/chrono/issues/1153 |
| 3378 | let p = PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#::parse(b"CRAZY5SHORT,M12.5.0/50,0/2").unwrap(); |
| 3379 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 3380 | p, |
| 3381 | PosixTimeZone { |
| 3382 | std_abbrev: "CRAZY".into(), |
| 3383 | std_offset: PosixOffset { second: -5 * 60 * 60 }, |
| 3384 | dst: Some(PosixDst { |
| 3385 | abbrev: "SHORT".into(), |
| 3386 | offset: PosixOffset { second: -4 * 60 * 60 }, |
| 3387 | rule: PosixRule { |
| 3388 | start: PosixDayTime { |
| 3389 | date: PosixDay::WeekdayOfMonth { |
| 3390 | month: 12, |
| 3391 | week: 5, |
| 3392 | weekday: 0, |
| 3393 | }, |
| 3394 | time: PosixTime { second: 50 * 60 * 60 }, |
| 3395 | }, |
| 3396 | end: PosixDayTime { |
| 3397 | date: PosixDay::JulianZero(0), |
| 3398 | time: PosixTime { second: 2 * 60 * 60 }, |
| 3399 | }, |
| 3400 | }, |
| 3401 | }), |
| 3402 | }, |
| 3403 | ); |
| 3404 | |
| 3405 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(b"America/New_York").is_err()); |
| 3406 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(b":America/New_York").is_err()); |
| 3407 | } |
| 3408 | |
| 3409 | // See: https://github.com/BurntSushi/jiff/issues/407 |
| 3410 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3411 | fn parse_empty_is_err() { |
| 3412 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(b"").is_err()); |
| 3413 | } |
| 3414 | |
| 3415 | // See: https://github.com/BurntSushi/jiff/issues/407 |
| 3416 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 3417 | fn parse_weird_is_err() { |
| 3418 | let s = |
| 3419 | b"AAAAAAAAAAAAAAACAAAAAAAAAAAAQA8AACAAAAAAAAAAAAAAAAACAAAAAAAAAAA"; |
| 3420 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(s).is_err()); |
| 3421 | |
| 3422 | let s = |
| 3423 | b"<AAAAAAAAAAAAAAACAAAAAAAAAAAAQA>8<AACAAAAAAAAAAAAAAAAACAAAAAAAAAAA>"; |
| 3424 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(s).is_err()); |
| 3425 | |
| 3426 | let s = b"PPPPPPPPPPPPPPPPPPPPnoofPPPAAA6DaPPPPPPPPPPPPPPPPPPPPPnoofPPPPP,n"; |
| 3427 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(s).is_err()); |
| 3428 | |
| 3429 | let s = b"oooooooooovooooooooooooooooool9<ooooo2o-o-oooooookoorooooooooroo8"; |
| 3430 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(PosixTimeZone::parse(s).is_err()); |
| 3431 | } |
| 3432 | } |