| 1 | 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/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/}; |
| 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/::{IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#, ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#}, |
| 7 | }, |
| 8 | PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#, TzifDateTimerust-analyzer cargo jiff 0.2.18 shared/TzifDateTime#, TzifFixedrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#, TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#, TzifLocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#, |
| 9 | TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned#, TzifTransitionInforust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#, TzifTransitionKindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#, TzifTransitionsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#, |
| 10 | TzifTransitionsOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionsOwned#, |
| 11 | }; |
| 12 | |
| 13 | // These are Jiff min and max timestamp (in seconds) values. |
| 14 | // |
| 15 | // The TZif parser will clamp timestamps to this range. It's |
| 16 | // not ideal, but Jiff can't handle values outside of this range |
| 17 | // and completely refusing to use TZif data with pathological |
| 18 | // timestamps in typically irrelevant transitions is bad juju. |
| 19 | // |
| 20 | // Ref: https://github.com/BurntSushi/jiff/issues/163 |
| 21 | // Ref: https://github.com/BurntSushi/jiff/pull/164 |
| 22 | const TIMESTAMP_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MIN.: i64 = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().377705023201; |
| 23 | const TIMESTAMP_MAXrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MAX.: i64 = 253402207200; |
| 24 | |
| 25 | // Similarly for offsets, although in this case, if we find |
| 26 | // an offset outside of this range, we do actually error. This |
| 27 | // is because it could result in true incorrect datetimes for |
| 28 | // actual transitions. |
| 29 | // |
| 30 | // But our supported offset range is `-25:59:59..=+25:59:59`. |
| 31 | // There's no real time zone with offsets even close to those |
| 32 | // boundaries. |
| 33 | // |
| 34 | // If there is pathological data that we should ignore, then |
| 35 | // we should wait for a real bug report in order to determine |
| 36 | // the right way to ignore/clamp it. |
| 37 | const OFFSET_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/OFFSET_MIN.: i32 = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().93599; |
| 38 | const OFFSET_MAXrust-analyzer cargo jiff 0.2.18 shared/tzif/OFFSET_MAX.: i32 = 93599; |
| 39 | |
| 40 | // When fattening TZif data, this is the year to go up to. |
| 41 | // |
| 42 | // This year was chosen because it's what the "fat" TZif data generated |
| 43 | // by `zic` uses. |
| 44 | const FATTEN_UP_TO_YEARrust-analyzer cargo jiff 0.2.18 shared/tzif/FATTEN_UP_TO_YEAR.: i16 = 2038; |
| 45 | |
| 46 | // This is a "sanity" limit on the maximum number of transitions we'll |
| 47 | // add to TZif data when fattening them up. |
| 48 | // |
| 49 | // This is mostly just a defense-in-depth limit to avoid weird cases |
| 50 | // where a pathological POSIX time zone could be defined to create |
| 51 | // many transitions. It's not clear that this is actually possible, |
| 52 | // but I felt a little uneasy doing unbounded work that isn't linearly |
| 53 | // proportional to the input data. So, this limit is put into place for |
| 54 | // reasons of "good sense." |
| 55 | // |
| 56 | // For "normal" cases, there should be at most two transitions per |
| 57 | // year. So this limit permits 300/2=150 years of transition data. |
| 58 | // (Although we won't go above `FATTEN_UP_TO_YEAR`. See above.) |
| 59 | const FATTEN_MAX_TRANSITIONSrust-analyzer cargo jiff 0.2.18 shared/tzif/FATTEN_MAX_TRANSITIONS.: usize = 300; |
| 60 | |
| 61 | impl TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned# { |
| 62 | /// Parses the given data as a TZif formatted file. |
| 63 | /// |
| 64 | /// The name given is attached to the `Tzif` value returned, but is |
| 65 | /// otherwise not significant. |
| 66 | /// |
| 67 | /// If the given data is not recognized to be valid TZif, then an error is |
| 68 | /// returned. |
| 69 | /// |
| 70 | /// In general, callers may assume that it is safe to pass arbitrary or |
| 71 | /// even untrusted data to this function and count on it not panicking |
| 72 | /// or using resources that aren't limited to a small constant factor of |
| 73 | /// the size of the data itself. That is, callers can reliably limit the |
| 74 | /// resources used by limiting the size of the data given to this parse |
| 75 | /// function. |
| 76 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) fn parserust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse().( |
| 77 | name: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 78 | bytes: &[u8], |
| 79 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned#, TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#> { |
| 80 | let original = bytes; |
| 81 | let name = name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 82 | let (header32, rest) = |
| 83 | Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#::parserust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]parse().(4, bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::Header32rust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header32#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 84 | let (mut tzif, rest) = if header32.versionrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#version. 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().0 { |
| 85 | TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned#::parse32rust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse32().(name, header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 86 | } else { |
| 87 | TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned#::parse64rust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse64().(name, header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 88 | }; |
| 89 | tzif.fattenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]fatten().(); |
| 90 | // This should come after fattening, because fattening may add new |
| 91 | // transitions and we want to add civil datetimes to those. |
| 92 | tzif.add_civil_datetimes_to_transitionsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_civil_datetimes_to_transitions().(); |
| 93 | tzif.verify_posix_time_zone_consistencyrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]verify_posix_time_zone_consistency().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 94 | // Compute the checksum using the entire contents of the TZif data. |
| 95 | let tzif_raw_len = (rest.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as usize) |
| 96 | .checked_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_sub().(original.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as usize) |
| 97 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 98 | let tzif_raw_bytes = &original[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#tzif_raw_len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 99 | tzif.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..checksumrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#checksum. = superrust-analyzer cargo jiff 0.2.18 shared/::crc32rust-analyzer cargo jiff 0.2.18 shared/crc32/::sumrust-analyzer cargo jiff 0.2.18 shared/crc32/sum().(tzif_raw_bytes); |
| 100 | |
| 101 | // Shrink all of our allocs so we don't keep excess capacity around. |
| 102 | tzif.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..shrink_to_fitrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]shrink_to_fit().(); |
| 103 | tzif.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types..shrink_to_fitrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]shrink_to_fit().(); |
| 104 | tzif.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps..shrink_to_fitrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]shrink_to_fit().(); |
| 105 | tzif.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts..shrink_to_fitrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]shrink_to_fit().(); |
| 106 | tzif.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..civil_endsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_ends..shrink_to_fitrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]shrink_to_fit().(); |
| 107 | tzif.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos..shrink_to_fitrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]shrink_to_fit().(); |
| 108 | |
| 109 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(tzif) |
| 110 | } |
| 111 | |
| 112 | fn parse32rust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse32().<'b>( |
| 113 | name: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 114 | header32: Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 115 | bytes: &'b [u8], |
| 116 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned#, &'b [u8]), TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#> { |
| 117 | let mut tzif = TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned# { |
| 118 | fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed.: TzifFixedrust-analyzer cargo jiff 0.2.18 shared/TzifFixed# { |
| 119 | namerust-analyzer cargo jiff 0.2.18 shared/TzifFixed#name., |
| 120 | versionrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#version.: header32.versionrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#version., |
| 121 | // filled in later |
| 122 | checksumrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#checksum.: 0, |
| 123 | designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(), |
| 124 | posix_tzrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#posix_tz.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 125 | }, |
| 126 | typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 127 | transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions.: TzifTransitionsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions# { |
| 128 | timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 129 | civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 130 | civil_endsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_ends.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 131 | infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 132 | }, |
| 133 | }; |
| 134 | let rest = tzif.parse_transitionsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_transitions().(&header32, bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 135 | let rest = tzif.parse_transition_typesrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_transition_types().(&header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 136 | let rest = tzif.parse_local_time_typesrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_local_time_types().(&header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 137 | let rest = tzif.parse_time_zone_designationsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_time_zone_designations().(&header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 138 | let rest = tzif.parse_leap_secondsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_leap_seconds().(&header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 139 | let rest = tzif.parse_indicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_indicators().(&header32, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 140 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((tzif, rest)) |
| 141 | } |
| 142 | |
| 143 | fn parse64rust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse64().<'b>( |
| 144 | name: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 145 | header32: Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 146 | bytes: &'b [u8], |
| 147 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned#, &'b [u8]), TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#> { |
| 148 | let (_, rest) = |
| 149 | try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().(SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::V1rust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#V1#, bytes, header32.data_block_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]data_block_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 150 | let (header64, rest) = |
| 151 | Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#::parserust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]parse().(8, rest).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::Header64rust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header64#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 152 | let mut tzif = TzifOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifOwned# { |
| 153 | fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed.: TzifFixedrust-analyzer cargo jiff 0.2.18 shared/TzifFixed# { |
| 154 | namerust-analyzer cargo jiff 0.2.18 shared/TzifFixed#name., |
| 155 | versionrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#version.: header64.versionrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#version., |
| 156 | // filled in later |
| 157 | checksumrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#checksum.: 0, |
| 158 | designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(), |
| 159 | posix_tzrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#posix_tz.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 160 | }, |
| 161 | typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 162 | transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions.: TzifTransitionsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions# { |
| 163 | timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 164 | civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 165 | civil_endsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_ends.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 166 | infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 167 | }, |
| 168 | }; |
| 169 | let rest = tzif.parse_transitionsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_transitions().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 170 | let rest = tzif.parse_transition_typesrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_transition_types().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 171 | let rest = tzif.parse_local_time_typesrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_local_time_types().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 172 | let rest = tzif.parse_time_zone_designationsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_time_zone_designations().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 173 | let rest = tzif.parse_leap_secondsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_leap_seconds().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 174 | let rest = tzif.parse_indicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_indicators().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 175 | let rest = tzif.parse_footerrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_footer().(&header64, rest)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 176 | // Note that we don't check that the TZif data is fully valid. It is |
| 177 | // possible for it to contain superfluous information. For example, a |
| 178 | // non-zero local time type that is never referenced by a transition. |
| 179 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((tzif, rest)) |
| 180 | } |
| 181 | |
| 182 | fn parse_transitionsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_transitions().<'b>( |
| 183 | &mut self, |
| 184 | header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 185 | bytes: &'b [u8], |
| 186 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#> { |
| 187 | let (bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 188 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::TransitionTimesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TransitionTimes#, |
| 189 | bytes, |
| 190 | header.transition_times_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]transition_times_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 191 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 192 | let mut it = bytes.chunks_exactrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_exact().(header.time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size.); |
| 193 | // RFC 8536 says: "If there are no transitions, local time for all |
| 194 | // timestamps is specified by the TZ string in the footer if present |
| 195 | // and nonempty; otherwise, it is specified by time type 0." |
| 196 | // |
| 197 | // RFC 8536 also says: "Local time for timestamps before the first |
| 198 | // transition is specified by the first time type (time type |
| 199 | // 0)." |
| 200 | // |
| 201 | // So if there are no transitions, pushing this dummy one will result |
| 202 | // in the desired behavior even when it's the only transition. |
| 203 | // Similarly, since this is the minimum timestamp value, it will |
| 204 | // trigger for any times before the first transition found in the TZif |
| 205 | // data. |
| 206 | self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..add_with_type_indexrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`TzifTransitions<vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_with_type_index().(TIMESTAMP_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MIN., 0); |
| 207 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(chunk) = it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`ChunksExact<'a, T>`][Iterator]next().() { |
| 208 | let mut timestamp = if header.is_32bitrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]is_32bit().() { |
| 209 | i64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`From<i32>`]from().(from_be_bytes_i32rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i32().(chunk)) |
| 210 | } else { |
| 211 | from_be_bytes_i64rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i64().(chunk) |
| 212 | }; |
| 213 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(TIMESTAMP_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MIN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().timestamp && timestamp rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().TIMESTAMP_MAXrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MAX.) { |
| 214 | // We really shouldn't error here just because the Unix |
| 215 | // timestamp is outside what Jiff supports. Since what Jiff |
| 216 | // supports is _somewhat_ arbitrary. But Jiff's supported |
| 217 | // range is good enough for all realistic purposes, so we |
| 218 | // just clamp an out-of-range Unix timestamp to the Jiff |
| 219 | // min or max value. |
| 220 | // |
| 221 | // This can't result in the sorting order being wrong, but |
| 222 | // it can result in a transition that is duplicative with |
| 223 | // the dummy transition we inserted above. This should be |
| 224 | // fine. |
| 225 | let clamped = timestamp.clamprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][Ord]clamp().(TIMESTAMP_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MIN., TIMESTAMP_MAXrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MAX.); |
| 226 | // only-jiff-start |
| 227 | warnrust-analyzer cargo jiff 0.2.18 logging/warn!!( |
| 228 | "found Unix timestamp `{timestamp}` that is outside \ |
| 229 | Jiff's supported range, clamping to `{clamped}`", |
| 230 | ); |
| 231 | // only-jiff-end |
| 232 | timestamp = clamped; |
| 233 | } |
| 234 | self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..addrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`TzifTransitions<vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add().(timestamp); |
| 235 | } |
| 236 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(it.remainderrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`ChunksExact<'a, T>`]remainder().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().()); |
| 237 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rest) |
| 238 | } |
| 239 | |
| 240 | fn parse_transition_typesrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_transition_types().<'b>( |
| 241 | &mut self, |
| 242 | header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 243 | bytes: &'b [u8], |
| 244 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#> { |
| 245 | let (bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 246 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::TransitionTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TransitionTypes#, |
| 247 | bytes, |
| 248 | header.transition_types_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]transition_types_len().(), |
| 249 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 250 | // We skip the first transition because it is our minimum dummy |
| 251 | // transition. |
| 252 | for (transition_index, &type_index) in (1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#).ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(bytes) { |
| 253 | if usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(type_index) 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().header.tzh_typecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_typecnt. { |
| 254 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#::ExceedsLocalTimeTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#ExceedsLocalTimeTypes#); |
| 255 | } |
| 256 | self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().transition_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..type_indexrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#type_index. = type_index; |
| 257 | } |
| 258 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rest) |
| 259 | } |
| 260 | |
| 261 | fn parse_local_time_typesrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_local_time_types().<'b>( |
| 262 | &mut self, |
| 263 | header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 264 | bytes: &'b [u8], |
| 265 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#> { |
| 266 | let (bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 267 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::LocalTimeTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#LocalTimeTypes#, |
| 268 | bytes, |
| 269 | header.local_time_types_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]local_time_types_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 270 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 271 | let mut it = bytes.chunks_exactrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_exact().(6); |
| 272 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(chunk) = it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`ChunksExact<'a, T>`][Iterator]next().() { |
| 273 | let offset = from_be_bytes_i32rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i32().(&chunk[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 274 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(OFFSET_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/OFFSET_MIN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().offset && offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]le().OFFSET_MAXrust-analyzer cargo jiff 0.2.18 shared/tzif/OFFSET_MAX.) { |
| 275 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#::fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<LocalTimeTypeError>`]from().( |
| 276 | LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#::InvalidOffsetrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#InvalidOffset# { offsetrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#InvalidOffset#offset. }, |
| 277 | )); |
| 278 | } |
| 279 | let is_dst = chunk[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core 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().1; |
| 280 | let designation = (chunk[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., chunk[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 281 | self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TzifLocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType# { |
| 282 | offsetrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#offset., |
| 283 | is_dstrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#is_dst., |
| 284 | designationrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#designation., |
| 285 | indicatorrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#indicator.: TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::LocalWallrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#LocalWall#, |
| 286 | }); |
| 287 | } |
| 288 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(it.remainderrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`ChunksExact<'a, T>`]remainder().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().()); |
| 289 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rest) |
| 290 | } |
| 291 | |
| 292 | fn parse_time_zone_designationsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_time_zone_designations().<'b>( |
| 293 | &mut self, |
| 294 | header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 295 | bytes: &'b [u8], |
| 296 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#> { |
| 297 | let (bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 298 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::TimeZoneDesignationsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TimeZoneDesignations#, |
| 299 | bytes, |
| 300 | header.time_zone_designations_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]time_zone_designations_len().(), |
| 301 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 302 | self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations. = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(bytes.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().()) |
| 303 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidUtf8#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 304 | // Holy hell, this is brutal. The boundary conditions are crazy. |
| 305 | for typ in self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().() { |
| 306 | let start = usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(typ.designationrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#designation..0); |
| 307 | let suffix = self |
| 308 | .fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed. |
| 309 | .designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations. |
| 310 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#) |
| 311 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::InvalidStartrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidStart#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 312 | let len = suffix |
| 313 | .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('\x00') |
| 314 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::MissingNulrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#MissingNul#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 315 | let end = start |
| 316 | .checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(len) |
| 317 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::InvalidLengthrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidLength#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 318 | typ.designationrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#designation..1 = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u8][`TryFrom<usize>`]try_from().(end) |
| 319 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::InvalidEndrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidEnd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 320 | } |
| 321 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rest) |
| 322 | } |
| 323 | |
| 324 | /// This parses the leap second corrections in the TZif data. |
| 325 | /// |
| 326 | /// Note that we only parse and verify them. We don't actually use them. |
| 327 | /// Jiff effectively ignores leap seconds. |
| 328 | fn parse_leap_secondsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_leap_seconds().<'b>( |
| 329 | &mut self, |
| 330 | header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 331 | bytes: &'b [u8], |
| 332 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#> { |
| 333 | let (bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 334 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::LeapSecondsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#LeapSeconds#, |
| 335 | bytes, |
| 336 | header.leap_second_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]leap_second_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 337 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 338 | let chunk_len = header |
| 339 | .time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size. |
| 340 | .checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(4) |
| 341 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("time_size plus 4 fits in usize"); |
| 342 | let mut it = bytes.chunks_exactrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_exact().(chunk_len); |
| 343 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(chunk) = it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`ChunksExact<'a, T>`][Iterator]next().() { |
| 344 | let (occur_bytes, _corr_bytes) = chunk.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(header.time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size.); |
| 345 | let occur = if header.is_32bitrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]is_32bit().() { |
| 346 | i64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`From<i32>`]from().(from_be_bytes_i32rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i32().(occur_bytes)) |
| 347 | } else { |
| 348 | from_be_bytes_i64rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i64().(occur_bytes) |
| 349 | }; |
| 350 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(TIMESTAMP_MINrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MIN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().occur && occur rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialOrd<Self>`]le().TIMESTAMP_MAXrust-analyzer cargo jiff 0.2.18 shared/tzif/TIMESTAMP_MAX.) { |
| 351 | // only-jiff-start |
| 352 | warnrust-analyzer cargo jiff 0.2.18 logging/warn!!( |
| 353 | "leap second occurrence `{occur}` is \ |
| 354 | not in Jiff's supported range" |
| 355 | ) |
| 356 | // only-jiff-end |
| 357 | } |
| 358 | } |
| 359 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(it.remainderrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`ChunksExact<'a, T>`]remainder().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().()); |
| 360 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rest) |
| 361 | } |
| 362 | |
| 363 | fn parse_indicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_indicators().<'b>( |
| 364 | &mut self, |
| 365 | header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 366 | bytes: &'b [u8], |
| 367 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#> { |
| 368 | let (std_wall_bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 369 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::StandardWallIndicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#StandardWallIndicators#, |
| 370 | bytes, |
| 371 | header.standard_wall_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]standard_wall_len().(), |
| 372 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 373 | let (ut_local_bytes, rest) = try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().( |
| 374 | SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::UTLocalIndicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#UTLocalIndicators#, |
| 375 | rest, |
| 376 | header.ut_local_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]ut_local_len().(), |
| 377 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 378 | if std_wall_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().ut_local_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 379 | // This is a weird case, but technically possible only if all |
| 380 | // UT/local indicators are 0. If any are 1, then it's an error, |
| 381 | // because it would require the corresponding std/wall indicator |
| 382 | // to be 1 too. Which it can't be, because there aren't any. So |
| 383 | // we just check that they're all zeros. |
| 384 | if ut_local_bytes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|&byte| 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().0) { |
| 385 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#::UtLocalNonZerorust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#UtLocalNonZero#); |
| 386 | } |
| 387 | } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().std_wall_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() && ut_local_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 388 | for (i, &byte) in std_wall_bytes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 389 | // Indexing is OK because Header guarantees that the number of |
| 390 | // indicators is 0 or equal to the number of types. |
| 391 | self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..indicatorrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#indicator. = if 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().0 { |
| 392 | TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::LocalWallrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#LocalWall# |
| 393 | } else if 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().1 { |
| 394 | TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::LocalStandardrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#LocalStandard# |
| 395 | } else { |
| 396 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#::InvalidStdWallIndicatorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidStdWallIndicator#); |
| 397 | }; |
| 398 | } |
| 399 | } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().std_wall_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().ut_local_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 400 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(std_wall_bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), ut_local_bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 401 | let it = std_wall_bytes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(ut_local_bytes); |
| 402 | for (i, (&stdwall, &utlocal)) in it.enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 403 | // Indexing is OK because Header guarantees that the number of |
| 404 | // indicators is 0 or equal to the number of types. |
| 405 | self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..indicatorrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#indicator. = match (stdwall, utlocal) { |
| 406 | (0, 0) => TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::LocalWallrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#LocalWall#, |
| 407 | (1, 0) => TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::LocalStandardrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#LocalStandard#, |
| 408 | (1, 1) => TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::UTStandardrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#UTStandard#, |
| 409 | (0, 1) => { |
| 410 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#::InvalidUtWallCombinationrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidUtWallCombination#); |
| 411 | } |
| 412 | _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#::InvalidCombinationrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidCombination#), |
| 413 | }; |
| 414 | } |
| 415 | } else { |
| 416 | // If they're both empty then we don't need to do anything. Every |
| 417 | // local time type record already has the correct default for this |
| 418 | // case set. |
| 419 | debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(std_wall_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().()); |
| 420 | debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(ut_local_bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().()); |
| 421 | } |
| 422 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rest) |
| 423 | } |
| 424 | |
| 425 | fn parse_footerrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]parse_footer().<'b>( |
| 426 | &mut self, |
| 427 | _header: &Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, |
| 428 | bytes: &'b [u8], |
| 429 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&'b [u8], FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#> { |
| 430 | if bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 431 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#::UnexpectedEndrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#UnexpectedEnd#); |
| 432 | } |
| 433 | if bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core 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'\n' { |
| 434 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#::MismatchEndrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#MismatchEnd#); |
| 435 | } |
| 436 | let bytes = &bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..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().; |
| 437 | // Only scan up to 1KB for a NUL terminator in case we somehow got |
| 438 | // passed a huge block of bytes. |
| 439 | let toscan = &bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().().minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(1024)]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 440 | let nlat = toscan |
| 441 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 442 | .positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|&b| b 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'\n') |
| 443 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#::TerminatorNotFoundrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#TerminatorNotFound#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 444 | let (bytes, rest) = bytes.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(nlat); |
| 445 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 446 | // We could in theory limit TZ strings to their strict POSIX |
| 447 | // definition here for TZif V2, but I don't think there is any |
| 448 | // harm in allowing the extensions in V2 formatted TZif data. Note |
| 449 | // that GNU tooling allows it via the `TZ` environment variable |
| 450 | // even though POSIX doesn't specify it. This all seems okay to me |
| 451 | // because the V3+ extension is a strict superset of functionality. |
| 452 | let posix_tz = PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#::parserust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<super::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]parse().(bytes) |
| 453 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#::InvalidPosixTzrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#InvalidPosixTz#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 454 | self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..posix_tzrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#posix_tz. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(posix_tz); |
| 455 | } |
| 456 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(&rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..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().) |
| 457 | } |
| 458 | |
| 459 | /// Validates that the POSIX TZ string we parsed (if one exists) is |
| 460 | /// consistent with the last transition in this time zone. This is |
| 461 | /// required by RFC 8536. |
| 462 | /// |
| 463 | /// RFC 8536 says, "If the string is nonempty and one or more |
| 464 | /// transitions appear in the version 2+ data, the string MUST be |
| 465 | /// consistent with the last version 2+ transition." |
| 466 | fn verify_posix_time_zone_consistencyrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]verify_posix_time_zone_consistency().( |
| 467 | &self, |
| 468 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#> { |
| 469 | // We need to be a little careful, since we always have at least one |
| 470 | // transition (accounting for the dummy `Timestamp::MIN` transition). |
| 471 | // So if we only have 1 transition and a POSIX TZ string, then we |
| 472 | // should not validate it since it's equivalent to the case of 0 |
| 473 | // transitions and a POSIX TZ string. |
| 474 | if self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().1 { |
| 475 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()); |
| 476 | } |
| 477 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref tz) = self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..posix_tzrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#posix_tz. else { |
| 478 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()); |
| 479 | }; |
| 480 | let last = self |
| 481 | .transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions. |
| 482 | .timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps. |
| 483 | .lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().() |
| 484 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("last transition timestamp"); |
| 485 | let type_index = self |
| 486 | .transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions. |
| 487 | .infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos. |
| 488 | .lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().() |
| 489 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("last transition info") |
| 490 | .type_indexrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#type_index.; |
| 491 | let typ = &self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(type_index)]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().; |
| 492 | let (ioff, abbrev, is_dst) = |
| 493 | tz.to_offset_inforust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]to_offset_info().(ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#::from_secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]from_second().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().last)); |
| 494 | if ioff.secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().typ.offsetrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#offset. { |
| 495 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#::Offsetrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Offset#); |
| 496 | } |
| 497 | if is_dst rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]ne().typ.is_dstrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#is_dst. { |
| 498 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#::Dstrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Dst#); |
| 499 | } |
| 500 | if abbrev rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().self.designationrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]designation().(&typ) { |
| 501 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#::Designationrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Designation#); |
| 502 | } |
| 503 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 504 | } |
| 505 | |
| 506 | /// Add civil datetimes to our transitions. |
| 507 | /// |
| 508 | /// This isn't strictly necessary, but it speeds up time zone lookups when |
| 509 | /// the input is a civil datetime. It lets us do comparisons directly on |
| 510 | /// the civil datetime as given, instead of needing to convert the civil |
| 511 | /// datetime given to a timestamp first. (Even if we didn't do this, I |
| 512 | /// believe we'd still need at least one additional timestamp that is |
| 513 | /// offset, because TZ lookups for a civil datetime are done in local time, |
| 514 | /// and the timestamps in TZif data are, of course, all in UTC.) |
| 515 | fn add_civil_datetimes_to_transitionsrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_civil_datetimes_to_transitions().(&mut self) { |
| 516 | fn to_datetimerust-analyzer cargo jiff 0.2.18 shared/tzif/to_datetime().(timestamp: i64, offset: i32) -> TzifDateTimerust-analyzer cargo jiff 0.2.18 shared/TzifDateTime# { |
| 517 | let its = ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp# { secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#second.: timestamp, nanosecondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#nanosecond.: 0 }; |
| 518 | let ioff = IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset# { secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second.: offset }; |
| 519 | let dt = its.to_datetimerust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]to_datetime().(ioff); |
| 520 | TzifDateTimerust-analyzer cargo jiff 0.2.18 shared/TzifDateTime#::newrust-analyzer cargo jiff 0.2.18 shared/impl#[TzifDateTime]new().( |
| 521 | 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., |
| 522 | dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..monthrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#month., |
| 523 | dt.daterust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#date..dayrust-analyzer cargo jiff 0.2.18 shared/util/itime/IDate#day., |
| 524 | dt.timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time..hourrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#hour., |
| 525 | dt.timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time..minuterust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#minute., |
| 526 | dt.timerust-analyzer cargo jiff 0.2.18 shared/util/itime/IDateTime#time..secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITime#second., |
| 527 | ) |
| 528 | } |
| 529 | |
| 530 | let trans = &mut self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions.; |
| 531 | // Special case the first transition, which is always a dummy |
| 532 | // transition establishing the lower bound. The loop below doesn't |
| 533 | // handle this correctly because it isn't guaranteed to get a |
| 534 | // `DateTime::MIN` value. |
| 535 | trans.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..kindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#kind. = TzifTransitionKindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#Unambiguous#; |
| 536 | trans.civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = TzifDateTimerust-analyzer cargo jiff 0.2.18 shared/TzifDateTime#::MINrust-analyzer cargo jiff 0.2.18 shared/impl#[TzifDateTime]MIN.; |
| 537 | for i in 1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#trans.timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() { |
| 538 | let timestamp = trans.timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().; |
| 539 | let offset = { |
| 540 | let type_index = trans.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..type_indexrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#type_index.; |
| 541 | self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(type_index)]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..offsetrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#offset. |
| 542 | }; |
| 543 | let prev_offset = { |
| 544 | let type_index = trans.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(1)]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..type_indexrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#type_index.; |
| 545 | self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(type_index)]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..offsetrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#offset. |
| 546 | }; |
| 547 | |
| 548 | if prev_offset 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().offset { |
| 549 | // Equivalent offsets means there can never be any ambiguity. |
| 550 | let start = to_datetimerust-analyzer cargo jiff 0.2.18 shared/tzif/to_datetime().(timestamp, prev_offset); |
| 551 | trans.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..kindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#kind. = TzifTransitionKindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#Unambiguous#; |
| 552 | trans.civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = start; |
| 553 | } else if prev_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().offset { |
| 554 | // When the offset of the previous transition is less, that |
| 555 | // means there is some non-zero amount of time that is |
| 556 | // "skipped" when moving to the next transition. Thus, we have |
| 557 | // a gap. The start of the gap is the offset which gets us the |
| 558 | // earliest time, i.e., the smaller of the two offsets. |
| 559 | trans.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..kindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#kind. = TzifTransitionKindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#::Gaprust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#Gap#; |
| 560 | trans.civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = to_datetimerust-analyzer cargo jiff 0.2.18 shared/tzif/to_datetime().(timestamp, prev_offset); |
| 561 | trans.civil_endsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_ends.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = to_datetimerust-analyzer cargo jiff 0.2.18 shared/tzif/to_datetime().(timestamp, offset); |
| 562 | } else { |
| 563 | // When the offset of the previous transition is greater, that |
| 564 | // means there is some non-zero amount of time that will be |
| 565 | // replayed on a wall clock in this time zone. Thus, we have |
| 566 | // a fold. The start of the gold is the offset which gets us |
| 567 | // the earliest time, i.e., the smaller of the two offsets. |
| 568 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(prev_offset >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). offset); |
| 569 | trans.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..kindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#kind. = TzifTransitionKindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#::Foldrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#Fold#; |
| 570 | trans.civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = to_datetimerust-analyzer cargo jiff 0.2.18 shared/tzif/to_datetime().(timestamp, offset); |
| 571 | trans.civil_endsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_ends.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = to_datetimerust-analyzer cargo jiff 0.2.18 shared/tzif/to_datetime().(timestamp, prev_offset); |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | /// Fatten up this TZif data with additional transitions. |
| 577 | /// |
| 578 | /// These additional transitions often make time zone lookups faster, and |
| 579 | /// they smooth out the performance difference between using "slim" and |
| 580 | /// "fat" tzdbs. |
| 581 | fn fattenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]fatten().(&mut self) { |
| 582 | // Note that this is a crate feature for *both* `jiff` and |
| 583 | // `jiff-static`. |
| 584 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(feature = "tz-fat") { |
| 585 | return; |
| 586 | } |
| 587 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(posix_tz) = self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..posix_tzrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#posix_tz..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().() else { return }; |
| 588 | let last = |
| 589 | self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps..lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("last transition"); |
| 590 | let mut i = 0; |
| 591 | let mut prev = ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#::from_secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/impl#[ITimestamp]from_second().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().last); |
| 592 | loop { |
| 593 | if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().FATTEN_MAX_TRANSITIONSrust-analyzer cargo jiff 0.2.18 shared/tzif/FATTEN_MAX_TRANSITIONS. { |
| 594 | // only-jiff-start |
| 595 | warnrust-analyzer cargo jiff 0.2.18 logging/warn!!( |
| 596 | "fattening TZif data for `{name:?}` somehow generated \ |
| 597 | more than {max} transitions, so giving up to avoid \ |
| 598 | doing too much work", |
| 599 | name = self.fixed.name, |
| 600 | max = FATTEN_MAX_TRANSITIONS, |
| 601 | ); |
| 602 | // only-jiff-end |
| 603 | return; |
| 604 | } |
| 605 | i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 606 | prev = match self.add_transitionrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_transition().(&posix_tz, prev) { |
| 607 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => break, |
| 608 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next) => next, |
| 609 | }; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | /// If there's a transition strictly after the given timestamp for the |
| 614 | /// given POSIX time zone, then add it to this TZif data. |
| 615 | fn add_transitionrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_transition().( |
| 616 | &mut self, |
| 617 | posix_tz: &PosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff 0.2.18 shared/util/array_str/Abbreviation#>, |
| 618 | prev: ITimestamprust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#, |
| 619 | ) -> 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#> { |
| 620 | let (its, ioff, abbrev, is_dst) = posix_tz.next_transitionrust-analyzer cargo jiff 0.2.18 shared/posix/impl#[`PosixTimeZone<ABBREV>`]next_transition().(prev)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 621 | if its.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.).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 cmp/impls/impl#[i16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i16][`PartialOrd<Self>`]ge().FATTEN_UP_TO_YEARrust-analyzer cargo jiff 0.2.18 shared/tzif/FATTEN_UP_TO_YEAR. { |
| 622 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 623 | } |
| 624 | let type_index = |
| 625 | self.find_or_create_local_time_typerust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]find_or_create_local_time_type().(ioff, abbrev, is_dst)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 626 | self.transitionsrust-analyzer cargo jiff 0.2.18 shared/Tzif#transitions..add_with_type_indexrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`TzifTransitions<vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_with_type_index().(its.secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/ITimestamp#second., type_index); |
| 627 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(its) |
| 628 | } |
| 629 | |
| 630 | /// Look for a local time type matching the data given. |
| 631 | /// |
| 632 | /// If one could not be found, then one is created and its index is |
| 633 | /// returned. |
| 634 | /// |
| 635 | /// If one could not be found and one could not be created (e.g., the index |
| 636 | /// would overflow `u8`), then `None` is returned. |
| 637 | fn find_or_create_local_time_typerust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]find_or_create_local_time_type().( |
| 638 | &mut self, |
| 639 | offset: IOffsetrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#, |
| 640 | abbrev: &str, |
| 641 | is_dst: bool, |
| 642 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u8> { |
| 643 | for (i, typ) in self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 644 | if 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 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().typ.offsetrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#offset. |
| 645 | && abbrev rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().self.designationrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]designation().(typ) |
| 646 | && is_dst rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[bool][`PartialEq<Self>`]eq().typ.is_dstrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#is_dst. |
| 647 | { |
| 648 | return u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u8][`TryFrom<usize>`]try_from().(i).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 649 | } |
| 650 | } |
| 651 | let i = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u8][`TryFrom<usize>`]try_from().(self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()).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().; |
| 652 | let designation = self.find_or_create_designationrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]find_or_create_designation().(abbrev)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 653 | self.typesrust-analyzer cargo jiff 0.2.18 shared/Tzif#types..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TzifLocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType# { |
| 654 | offsetrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#offset.: offset.secondrust-analyzer cargo jiff 0.2.18 shared/util/itime/IOffset#second., |
| 655 | is_dstrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#is_dst., |
| 656 | designationrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#designation., |
| 657 | // Not really clear if this is correct, but Jiff |
| 658 | // ignores this anyway, so ¯\_(ツ)_/¯. |
| 659 | indicatorrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#indicator.: TzifIndicatorrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#::LocalWallrust-analyzer cargo jiff 0.2.18 shared/TzifIndicator#LocalWall#, |
| 660 | }); |
| 661 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(i) |
| 662 | } |
| 663 | |
| 664 | /// Look for a designation (i.e., time zone abbreviation) matching the data |
| 665 | /// given, and return its range into `self.fixed.designations`. |
| 666 | /// |
| 667 | /// If one could not be found, then one is created and its range is |
| 668 | /// returned. |
| 669 | /// |
| 670 | /// If one could not be found and one could not be created (e.g., the range |
| 671 | /// would overflow `u8`), then `None` is returned. |
| 672 | fn find_or_create_designationrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]find_or_create_designation().( |
| 673 | &mut self, |
| 674 | needle: &str, |
| 675 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(u8, u8)> { |
| 676 | let mut start = 0; |
| 677 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(offset) = self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()..findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('\0') { |
| 678 | let end = start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().offset; |
| 679 | let abbrev = &self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().; |
| 680 | if needle rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().abbrev { |
| 681 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((start.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().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()., end.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().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().)); |
| 682 | } |
| 683 | start = end rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1; |
| 684 | } |
| 685 | |
| 686 | // Now we need to add a new abbreviation. This |
| 687 | // should generally only happen for malformed TZif |
| 688 | // data. i.e., TZif data with a POSIX time zone that |
| 689 | // contains an TZ abbreviation that isn't found in |
| 690 | // the TZif's designation list. |
| 691 | // |
| 692 | // And since we're guarding against malformed data, |
| 693 | // the designation list might not end with NUL. If |
| 694 | // not, add one. |
| 695 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().('\0') { |
| 696 | self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\0'); |
| 697 | } |
| 698 | let start = self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(); |
| 699 | self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(needle); |
| 700 | self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\0'); |
| 701 | let end = self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(); |
| 702 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((start.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().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()., end.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().().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().)) |
| 703 | } |
| 704 | |
| 705 | fn designationrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, vec::Vec<TzifLocalTimeType>, vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]designation().(&self, typ: &TzifLocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#) -> &str { |
| 706 | let range = |
| 707 | usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(typ.designationrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#designation..0)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(typ.designationrust-analyzer cargo jiff 0.2.18 shared/TzifLocalTimeType#designation..1); |
| 708 | // OK because we verify that the designation range on every local |
| 709 | // time type is a valid range into `self.designations`. |
| 710 | &self.fixedrust-analyzer cargo jiff 0.2.18 shared/Tzif#fixed..designationsrust-analyzer cargo jiff 0.2.18 shared/TzifFixed#designations.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().range]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index(). |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | impl TzifTransitionsOwnedrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionsOwned# { |
| 715 | /// Add a single transition with the given timestamp. |
| 716 | /// |
| 717 | /// This also fills in the other columns (civil starts, civil ends and |
| 718 | /// infos) with sensible default values. It is expected that callers will |
| 719 | /// later fill them in. |
| 720 | fn addrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`TzifTransitions<vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add().(&mut self, timestamp: i64) { |
| 721 | self.add_with_type_indexrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`TzifTransitions<vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_with_type_index().(timestamp, 0); |
| 722 | } |
| 723 | |
| 724 | /// Like `TzifTransitionsOwned::add`, but let's the caller provide a type |
| 725 | /// index if it is known. |
| 726 | fn add_with_type_indexrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[`TzifTransitions<vec::Vec<i64>, vec::Vec<TzifDateTime>, vec::Vec<TzifDateTime>, vec::Vec<TzifTransitionInfo>>`]add_with_type_index().(&mut self, timestamp: i64, type_index: u8) { |
| 727 | self.timestampsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#timestamps..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(timestamp); |
| 728 | self.civil_startsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_starts..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TzifDateTimerust-analyzer cargo jiff 0.2.18 shared/TzifDateTime#::ZEROrust-analyzer cargo jiff 0.2.18 shared/impl#[TzifDateTime]ZERO.); |
| 729 | self.civil_endsrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#civil_ends..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TzifDateTimerust-analyzer cargo jiff 0.2.18 shared/TzifDateTime#::ZEROrust-analyzer cargo jiff 0.2.18 shared/impl#[TzifDateTime]ZERO.); |
| 730 | self.infosrust-analyzer cargo jiff 0.2.18 shared/TzifTransitions#infos..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TzifTransitionInforust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo# { |
| 731 | type_indexrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#type_index., |
| 732 | kindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionInfo#kind.: TzifTransitionKindrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#::Unambiguousrust-analyzer cargo jiff 0.2.18 shared/TzifTransitionKind#Unambiguous#, |
| 733 | }); |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | /// The header for a TZif formatted file. |
| 738 | /// |
| 739 | /// V2+ TZif format have two headers: one for V1 data, and then a second |
| 740 | /// following the V1 data block that describes another data block which uses |
| 741 | /// 64-bit timestamps. The two headers both have the same format and both |
| 742 | /// use 32-bit big-endian encoded integers. |
| 743 | #[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:)] |
| 744 | struct Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header# { |
| 745 | /// The size of the timestamps encoded in the data block. |
| 746 | /// |
| 747 | /// This is guaranteed to be either 4 (for V1) or 8 (for the 64-bit header |
| 748 | /// block in V2+). |
| 749 | time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size.: usize, |
| 750 | /// The file format version. |
| 751 | /// |
| 752 | /// Note that this is either a NUL byte (for version 1), or an ASCII byte |
| 753 | /// corresponding to the version number. That is, `0x32` for `2`, `0x33` |
| 754 | /// for `3` or `0x34` for `4`. Note also that just because zoneinfo might |
| 755 | /// have been recently generated does not mean it uses the latest format |
| 756 | /// version. It seems like newer versions are only compiled by `zic` when |
| 757 | /// they are needed. For example, `America/New_York` on my system (as of |
| 758 | /// `2024-03-25`) has version `0x32`, but `Asia/Jerusalem` has version |
| 759 | /// `0x33`. |
| 760 | versionrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#version.: u8, |
| 761 | /// Number of UT/local indicators stored in the file. |
| 762 | /// |
| 763 | /// This is checked to be either equal to `0` or equal to `tzh_typecnt`. |
| 764 | tzh_ttisutcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_ttisutcnt.: usize, |
| 765 | /// The number of standard/wall indicators stored in the file. |
| 766 | /// |
| 767 | /// This is checked to be either equal to `0` or equal to `tzh_typecnt`. |
| 768 | tzh_ttisstdcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_ttisstdcnt.: usize, |
| 769 | /// The number of leap seconds for which data entries are stored in the |
| 770 | /// file. |
| 771 | tzh_leapcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_leapcnt.: usize, |
| 772 | /// The number of transition times for which data entries are stored in |
| 773 | /// the file. |
| 774 | tzh_timecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_timecnt.: usize, |
| 775 | /// The number of local time types for which data entries are stored in the |
| 776 | /// file. |
| 777 | /// |
| 778 | /// This is checked to be at least `1`. |
| 779 | tzh_typecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_typecnt.: usize, |
| 780 | /// The number of bytes of time zone abbreviation strings stored in the |
| 781 | /// file. |
| 782 | /// |
| 783 | /// This is checked to be at least `1`. |
| 784 | tzh_charcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_charcnt.: usize, |
| 785 | } |
| 786 | |
| 787 | impl Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header# { |
| 788 | /// Parse the header record from the given bytes. |
| 789 | /// |
| 790 | /// Upon success, return the header and all bytes after the header. |
| 791 | /// |
| 792 | /// The given `time_size` must be 4 or 8, corresponding to either the |
| 793 | /// V1 header block or the V2+ header block, respectively. |
| 794 | fn parserust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]parse().( |
| 795 | time_size: usize, |
| 796 | bytes: &[u8], |
| 797 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#, &[u8]), HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#> { |
| 798 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(time_size == 4 || time_size == 8, "time size must be 4 or 8"); |
| 799 | if bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]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().44 { |
| 800 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::TooShortrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#TooShort#); |
| 801 | } |
| 802 | let (magic, rest) = bytes.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 803 | if magic rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().b"TZif" { |
| 804 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::MismatchMagicrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchMagic#); |
| 805 | } |
| 806 | let (version, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(1); |
| 807 | let (_reserved, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(15); |
| 808 | |
| 809 | let (tzh_ttisutcnt_bytes, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 810 | let (tzh_ttisstdcnt_bytes, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 811 | let (tzh_leapcnt_bytes, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 812 | let (tzh_timecnt_bytes, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 813 | let (tzh_typecnt_bytes, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 814 | let (tzh_charcnt_bytes, rest) = rest.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(4); |
| 815 | |
| 816 | let tzh_ttisutcnt = |
| 817 | from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(tzh_ttisutcnt_bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 818 | HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::Utrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Ut#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: e } |
| 819 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 820 | let tzh_ttisstdcnt = |
| 821 | from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(tzh_ttisstdcnt_bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 822 | HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::Stdrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Std#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: e } |
| 823 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 824 | let tzh_leapcnt = |
| 825 | from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(tzh_leapcnt_bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 826 | HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::Leaprust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Leap#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: e } |
| 827 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 828 | let tzh_timecnt = |
| 829 | from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(tzh_timecnt_bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 830 | HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::Timerust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Time#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: e } |
| 831 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 832 | let tzh_typecnt = |
| 833 | from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(tzh_typecnt_bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 834 | HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::Typerust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Type#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: e } |
| 835 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 836 | let tzh_charcnt = |
| 837 | from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(tzh_charcnt_bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 838 | HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::Charrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Char#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: e } |
| 839 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 840 | |
| 841 | if tzh_ttisutcnt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 && tzh_ttisutcnt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().tzh_typecnt { |
| 842 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::MismatchUtTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchUtType#); |
| 843 | } |
| 844 | if tzh_ttisstdcnt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 && tzh_ttisstdcnt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().tzh_typecnt { |
| 845 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::MismatchStdTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchStdType#); |
| 846 | } |
| 847 | if tzh_typecnt 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().1 { |
| 848 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ZeroTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ZeroType#); |
| 849 | } |
| 850 | if tzh_charcnt 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().1 { |
| 851 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::ZeroCharrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ZeroChar#); |
| 852 | } |
| 853 | |
| 854 | let header = Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/Header# { |
| 855 | time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size., |
| 856 | versionrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#version.: version[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 857 | tzh_ttisutcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_ttisutcnt., |
| 858 | tzh_ttisstdcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_ttisstdcnt., |
| 859 | tzh_leapcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_leapcnt., |
| 860 | tzh_timecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_timecnt., |
| 861 | tzh_typecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_typecnt., |
| 862 | tzh_charcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_charcnt., |
| 863 | }; |
| 864 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((header, rest)) |
| 865 | } |
| 866 | |
| 867 | /// Returns true if this header is for a 32-bit data block. |
| 868 | /// |
| 869 | /// When false, it is guaranteed that this header is for a 64-bit data |
| 870 | /// block. |
| 871 | fn is_32bitrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]is_32bit().(&self) -> bool { |
| 872 | self.time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size. 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().4 |
| 873 | } |
| 874 | |
| 875 | /// Returns the size of the data block, in bytes, for this header. |
| 876 | /// |
| 877 | /// This returns an error if the arithmetic required to compute the |
| 878 | /// length would overflow. |
| 879 | /// |
| 880 | /// This is useful for, e.g., skipping over the 32-bit V1 data block in |
| 881 | /// V2+ TZif formatted files. |
| 882 | fn data_block_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]data_block_len().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#> { |
| 883 | let a = self.transition_times_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]transition_times_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 884 | let b = self.transition_types_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]transition_types_len().(); |
| 885 | let c = self.local_time_types_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]local_time_types_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 886 | let d = self.time_zone_designations_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]time_zone_designations_len().(); |
| 887 | let e = self.leap_second_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]leap_second_len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 888 | let f = self.standard_wall_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]standard_wall_len().(); |
| 889 | let g = self.ut_local_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]ut_local_len().(); |
| 890 | a.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(b) |
| 891 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|z| z.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(c)) |
| 892 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|z| z.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(d)) |
| 893 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|z| z.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(e)) |
| 894 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|z| z.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(f)) |
| 895 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|z| z.checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(g)) |
| 896 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::InvalidDataBlockrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidDataBlock# { versionrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidDataBlock#version.: self.versionrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#version. }) |
| 897 | } |
| 898 | |
| 899 | fn transition_times_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]transition_times_len().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#> { |
| 900 | self.tzh_timecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_timecnt. |
| 901 | .checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_mul().(self.time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size.) |
| 902 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::InvalidTimeCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidTimeCount#) |
| 903 | } |
| 904 | |
| 905 | fn transition_types_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]transition_types_len().(&self) -> usize { |
| 906 | self.tzh_timecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_timecnt. |
| 907 | } |
| 908 | |
| 909 | fn local_time_types_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]local_time_types_len().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#> { |
| 910 | self.tzh_typecntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_typecnt..checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_mul().(6).ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::InvalidTypeCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidTypeCount#) |
| 911 | } |
| 912 | |
| 913 | fn time_zone_designations_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]time_zone_designations_len().(&self) -> usize { |
| 914 | self.tzh_charcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_charcnt. |
| 915 | } |
| 916 | |
| 917 | fn leap_second_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]leap_second_len().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#> { |
| 918 | let record_len = self |
| 919 | .time_sizerust-analyzer cargo jiff 0.2.18 shared/tzif/Header#time_size. |
| 920 | .checked_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_add().(4) |
| 921 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("4-or-8 plus 4 always fits in usize"); |
| 922 | self.tzh_leapcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_leapcnt. |
| 923 | .checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_mul().(record_len) |
| 924 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::InvalidLeapSecondCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidLeapSecondCount#) |
| 925 | } |
| 926 | |
| 927 | fn standard_wall_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]standard_wall_len().(&self) -> usize { |
| 928 | self.tzh_ttisstdcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_ttisstdcnt. |
| 929 | } |
| 930 | |
| 931 | fn ut_local_lenrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[Header]ut_local_len().(&self) -> usize { |
| 932 | self.tzh_ttisutcntrust-analyzer cargo jiff 0.2.18 shared/tzif/Header#tzh_ttisutcnt. |
| 933 | } |
| 934 | } |
| 935 | |
| 936 | #[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:)] |
| 937 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) struct TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 938 | kindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#kind.: TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#, |
| 939 | } |
| 940 | |
| 941 | #[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:)] |
| 942 | enum TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind# { |
| 943 | Footerrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Footer#(FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#), |
| 944 | Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#), |
| 945 | Header32rust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header32#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#), |
| 946 | Header64rust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header64#(HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#), |
| 947 | InconsistentPosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#InconsistentPosixTimeZone#(InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#), |
| 948 | Indicatorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Indicator#(IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#), |
| 949 | LocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#LocalTimeType#(LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#), |
| 950 | SplitAtrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#SplitAt#(SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#), |
| 951 | TimeZoneDesignatorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#TimeZoneDesignator#(TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#), |
| 952 | TransitionTyperust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#TransitionType#(TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#), |
| 953 | } |
| 954 | |
| 955 | #[cfg(feature = "std")] |
| 956 | impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# {} |
| 957 | |
| 958 | 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 TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 959 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][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# { |
| 960 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::*; |
| 961 | match self.kindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#kind. { |
| 962 | Footerrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Footer#(ref err) => { |
| 963 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid TZif footer: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 964 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[FooterError][Display]fmt().(f) |
| 965 | } |
| 966 | Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header#(ref err) => { |
| 967 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid TZif header: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 968 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[HeaderError][Display]fmt().(f) |
| 969 | } |
| 970 | Header32rust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header32#(ref err) => { |
| 971 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid 32-bit TZif header: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 972 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[HeaderError][Display]fmt().(f) |
| 973 | } |
| 974 | Header64rust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header64#(ref err) => { |
| 975 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid 64-bit TZif header: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 976 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[HeaderError][Display]fmt().(f) |
| 977 | } |
| 978 | InconsistentPosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#InconsistentPosixTimeZone#(ref err) => { |
| 979 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 980 | "found inconsistency with \ |
| 981 | POSIX time zone transition rule \ |
| 982 | in TZif file footer: ", |
| 983 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 984 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[InconsistentPosixTimeZoneError][Display]fmt().(f) |
| 985 | } |
| 986 | Indicatorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Indicator#(ref err) => { |
| 987 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse indicators: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 988 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[IndicatorError][Display]fmt().(f) |
| 989 | } |
| 990 | LocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#LocalTimeType#(ref err) => { |
| 991 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse local time types: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 992 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[LocalTimeTypeError][Display]fmt().(f) |
| 993 | } |
| 994 | SplitAtrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#SplitAt#(ref err) => err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[SplitAtError][Display]fmt().(f), |
| 995 | TimeZoneDesignatorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#TimeZoneDesignator#(ref err) => { |
| 996 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse time zone designators: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 997 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TimeZoneDesignatorError][Display]fmt().(f) |
| 998 | } |
| 999 | TransitionTyperust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#TransitionType#(ref err) => { |
| 1000 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("failed to parse time zone transition types: ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1001 | err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TransitionTypeError][Display]fmt().(f) |
| 1002 | } |
| 1003 | } |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1008 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<TzifErrorKind>`]from().(kind: TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1009 | TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError#kind. } |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | #[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:)] |
| 1014 | enum TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError# { |
| 1015 | ExceedsLocalTimeTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#ExceedsLocalTimeTypes#, |
| 1016 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#Split#(SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#), |
| 1017 | } |
| 1018 | |
| 1019 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1020 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<TransitionTypeError>`]from().(err: TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1021 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::TransitionTyperust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#TransitionType#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#> for TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError# { |
| 1026 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TransitionTypeError][`From<SplitAtError>`]from().(err: SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#) -> TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError# { |
| 1027 | TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#::Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#Split#(err) |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | 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 TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError# { |
| 1032 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TransitionTypeError][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# { |
| 1033 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::TransitionTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#::*; |
| 1034 | |
| 1035 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1036 | ExceedsLocalTimeTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#ExceedsLocalTimeTypes# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1037 | "found time zone transition type index \ |
| 1038 | that exceeds the number of local time types", |
| 1039 | ), |
| 1040 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/TransitionTypeError#Split#(ref err) => err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[SplitAtError][Display]fmt().(f), |
| 1041 | } |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | #[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:)] |
| 1046 | enum LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError# { |
| 1047 | InvalidOffsetrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#InvalidOffset# { offsetrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#InvalidOffset#offset.: i32 }, |
| 1048 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#Split#(SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#), |
| 1049 | } |
| 1050 | |
| 1051 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1052 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<LocalTimeTypeError>`]from().(err: LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1053 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::LocalTimeTyperust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#LocalTimeType#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#> for LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError# { |
| 1058 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[LocalTimeTypeError][`From<SplitAtError>`]from().(err: SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#) -> LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError# { |
| 1059 | LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#::Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#Split#(err) |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | 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 LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError# { |
| 1064 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[LocalTimeTypeError][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# { |
| 1065 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::LocalTimeTypeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#::*; |
| 1066 | |
| 1067 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1068 | InvalidOffsetrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#InvalidOffset# { offsetrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#InvalidOffset#offset. } => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 1069 | f, |
| 1070 | "found local time type with \ |
| 1071 | out-of-bounds time zone offset: {offset}, \ |
| 1072 | Jiff's allowed range is `{OFFSET_MIN}..={OFFSET_MAX}`" |
| 1073 | ), |
| 1074 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/LocalTimeTypeError#Split#(ref err) => err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[SplitAtError][Display]fmt().(f), |
| 1075 | } |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | #[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:)] |
| 1080 | enum TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError# { |
| 1081 | InvalidEndrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidEnd#, |
| 1082 | InvalidLengthrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidLength#, |
| 1083 | InvalidStartrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidStart#, |
| 1084 | InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidUtf8#, |
| 1085 | MissingNulrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#MissingNul#, |
| 1086 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#Split#(SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#), |
| 1087 | } |
| 1088 | |
| 1089 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1090 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<TimeZoneDesignatorError>`]from().(err: TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1091 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::TimeZoneDesignatorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#TimeZoneDesignator#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#> for TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError# { |
| 1096 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TimeZoneDesignatorError][`From<SplitAtError>`]from().(err: SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#) -> TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError# { |
| 1097 | TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#Split#(err) |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | 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 TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError# { |
| 1102 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TimeZoneDesignatorError][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# { |
| 1103 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::TimeZoneDesignatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#::*; |
| 1104 | |
| 1105 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1106 | InvalidEndrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidEnd# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1107 | "found invalid end of time zone designator \ |
| 1108 | for local time type", |
| 1109 | ), |
| 1110 | InvalidLengthrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidLength# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1111 | "found invalid length of time zone designator \ |
| 1112 | for local time type", |
| 1113 | ), |
| 1114 | InvalidStartrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidStart# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1115 | "found invalid start of time zone designator \ |
| 1116 | for local time type", |
| 1117 | ), |
| 1118 | InvalidUtf8rust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#InvalidUtf8# => { |
| 1119 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("found invalid UTF-8 in time zone designators") |
| 1120 | } |
| 1121 | MissingNulrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#MissingNul# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1122 | "could not find NUL terminator for time zone designator", |
| 1123 | ), |
| 1124 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/TimeZoneDesignatorError#Split#(ref err) => err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[SplitAtError][Display]fmt().(f), |
| 1125 | } |
| 1126 | } |
| 1127 | } |
| 1128 | |
| 1129 | #[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:)] |
| 1130 | enum IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError# { |
| 1131 | InvalidCombinationrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidCombination#, |
| 1132 | InvalidStdWallIndicatorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidStdWallIndicator#, |
| 1133 | InvalidUtWallCombinationrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidUtWallCombination#, |
| 1134 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#Split#(SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#), |
| 1135 | UtLocalNonZerorust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#UtLocalNonZero#, |
| 1136 | } |
| 1137 | |
| 1138 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1139 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<IndicatorError>`]from().(err: IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1140 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::Indicatorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Indicator#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1141 | } |
| 1142 | } |
| 1143 | |
| 1144 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#> for IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError# { |
| 1145 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[IndicatorError][`From<SplitAtError>`]from().(err: SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#) -> IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError# { |
| 1146 | IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#::Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#Split#(err) |
| 1147 | } |
| 1148 | } |
| 1149 | |
| 1150 | 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 IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError# { |
| 1151 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[IndicatorError][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# { |
| 1152 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::IndicatorErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#::*; |
| 1153 | |
| 1154 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1155 | InvalidCombinationrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidCombination# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1156 | "found invalid std/wall or UT/local value for \ |
| 1157 | local time type, each must be 0 or 1", |
| 1158 | ), |
| 1159 | InvalidStdWallIndicatorrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidStdWallIndicator# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1160 | "found invalid std/wall indicator, \ |
| 1161 | expected it to be 0 or 1", |
| 1162 | ), |
| 1163 | InvalidUtWallCombinationrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#InvalidUtWallCombination# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1164 | "found invalid UT-wall combination for \ |
| 1165 | local time type, only local-wall, \ |
| 1166 | local-standard and UT-standard are allowed", |
| 1167 | ), |
| 1168 | Splitrust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#Split#(ref err) => err.fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[SplitAtError][Display]fmt().(f), |
| 1169 | UtLocalNonZerorust-analyzer cargo jiff 0.2.18 shared/tzif/IndicatorError#UtLocalNonZero# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1170 | "found non-zero UT/local indicator, \ |
| 1171 | but all such indicators should be zero", |
| 1172 | ), |
| 1173 | } |
| 1174 | } |
| 1175 | } |
| 1176 | |
| 1177 | #[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:)] |
| 1178 | enum InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError# { |
| 1179 | Designationrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Designation#, |
| 1180 | Dstrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Dst#, |
| 1181 | Offsetrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Offset#, |
| 1182 | } |
| 1183 | |
| 1184 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1185 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<InconsistentPosixTimeZoneError>`]from().(err: InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1186 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::InconsistentPosixTimeZonerust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#InconsistentPosixTimeZone#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1187 | } |
| 1188 | } |
| 1189 | |
| 1190 | 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 InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError# { |
| 1191 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[InconsistentPosixTimeZoneError][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# { |
| 1192 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::InconsistentPosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#::*; |
| 1193 | |
| 1194 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1195 | Designationrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Designation# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1196 | "expected last transition in TZif file to have \ |
| 1197 | a time zone abbreviation matching the abbreviation \ |
| 1198 | derived from the POSIX time zone transition rule", |
| 1199 | ), |
| 1200 | Dstrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Dst# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1201 | "expected last transition in TZif file to have \ |
| 1202 | a DST status matching the status derived from the \ |
| 1203 | POSIX time zone transition rule", |
| 1204 | ), |
| 1205 | Offsetrust-analyzer cargo jiff 0.2.18 shared/tzif/InconsistentPosixTimeZoneError#Offset# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1206 | "expected last transition in TZif file to have \ |
| 1207 | DST offset matching the offset derived from the \ |
| 1208 | POSIX time zone transition rule", |
| 1209 | ), |
| 1210 | } |
| 1211 | } |
| 1212 | } |
| 1213 | |
| 1214 | #[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:)] |
| 1215 | enum FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError# { |
| 1216 | InvalidPosixTzrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#InvalidPosixTz#(craterust-analyzer cargo jiff 0.2.18 crate/::sharedrust-analyzer cargo jiff 0.2.18 shared/::posixrust-analyzer cargo jiff 0.2.18 shared/posix/::PosixTimeZoneErrorrust-analyzer cargo jiff 0.2.18 shared/posix/PosixTimeZoneError#), |
| 1217 | MismatchEndrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#MismatchEnd#, |
| 1218 | TerminatorNotFoundrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#TerminatorNotFound#, |
| 1219 | UnexpectedEndrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#UnexpectedEnd#, |
| 1220 | } |
| 1221 | |
| 1222 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1223 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<FooterError>`]from().(err: FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1224 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::Footerrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Footer#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1225 | } |
| 1226 | } |
| 1227 | |
| 1228 | 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 FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError# { |
| 1229 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[FooterError][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# { |
| 1230 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::FooterErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#::*; |
| 1231 | |
| 1232 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1233 | InvalidPosixTzrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#InvalidPosixTz#(ref err) => { |
| 1234 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid POSIX time zone transition rule")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1235 | 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#[PosixTimeZoneError][Display]fmt().(err, f) |
| 1236 | } |
| 1237 | MismatchEndrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#MismatchEnd# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1238 | "expected to find `\\n` at the beginning of \ |
| 1239 | the TZif file footer, \ |
| 1240 | but found something else instead", |
| 1241 | ), |
| 1242 | TerminatorNotFoundrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#TerminatorNotFound# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1243 | "expected to find `\\n` terminating \ |
| 1244 | the TZif file footer, \ |
| 1245 | but no line terminator could be found", |
| 1246 | ), |
| 1247 | UnexpectedEndrust-analyzer cargo jiff 0.2.18 shared/tzif/FooterError#UnexpectedEnd# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1248 | "expected to find `\\n` at the beginning of \ |
| 1249 | the TZif file footer, \ |
| 1250 | but found unexpected end of data", |
| 1251 | ), |
| 1252 | } |
| 1253 | } |
| 1254 | } |
| 1255 | |
| 1256 | #[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:)] |
| 1257 | enum HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError# { |
| 1258 | InvalidDataBlockrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidDataBlock# { versionrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidDataBlock#version.: u8 }, |
| 1259 | InvalidLeapSecondCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidLeapSecondCount#, |
| 1260 | InvalidTimeCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidTimeCount#, |
| 1261 | InvalidTypeCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidTypeCount#, |
| 1262 | MismatchMagicrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchMagic#, |
| 1263 | MismatchStdTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchStdType#, |
| 1264 | MismatchUtTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchUtType#, |
| 1265 | ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind.: CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#, convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert.: U32UsizeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/U32UsizeError# }, |
| 1266 | TooShortrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#TooShort#, |
| 1267 | ZeroCharrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ZeroChar#, |
| 1268 | ZeroTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ZeroType#, |
| 1269 | } |
| 1270 | |
| 1271 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1272 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<HeaderError>`]from().(err: HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1273 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::Headerrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#Header#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1274 | } |
| 1275 | } |
| 1276 | |
| 1277 | 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 HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError# { |
| 1278 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[HeaderError][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# { |
| 1279 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::HeaderErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#::*; |
| 1280 | |
| 1281 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1282 | InvalidDataBlockrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidDataBlock# { versionrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidDataBlock#version. } => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 1283 | f, |
| 1284 | "length of data block in V{version} TZif file is too big", |
| 1285 | ), |
| 1286 | InvalidLeapSecondCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidLeapSecondCount# => { |
| 1287 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("number of leap seconds is too big") |
| 1288 | } |
| 1289 | InvalidTimeCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidTimeCount# => { |
| 1290 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("number of transition times is too big") |
| 1291 | } |
| 1292 | InvalidTypeCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#InvalidTypeCount# => { |
| 1293 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("number of local time types is too big") |
| 1294 | } |
| 1295 | MismatchMagicrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchMagic# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("magic bytes mismatch"), |
| 1296 | MismatchStdTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchStdType# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1297 | "expected number of standard/wall indicators to be zero \ |
| 1298 | or equal to the number of local time types", |
| 1299 | ), |
| 1300 | MismatchUtTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#MismatchUtType# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1301 | "expected number of UT/local indicators to be zero \ |
| 1302 | or equal to the number of local time types", |
| 1303 | ), |
| 1304 | ParseCountrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount# { ref kindrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#kind., ref convertrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ParseCount#convert. } => { |
| 1305 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "failed to parse `{kind}`: {convert}") |
| 1306 | } |
| 1307 | TooShortrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#TooShort# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("too short"), |
| 1308 | ZeroCharrust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ZeroChar# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1309 | "expected number of time zone abbreviations fo be at least 1", |
| 1310 | ), |
| 1311 | ZeroTyperust-analyzer cargo jiff 0.2.18 shared/tzif/HeaderError#ZeroType# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().( |
| 1312 | "expected number of local time types fo be at least 1", |
| 1313 | ), |
| 1314 | } |
| 1315 | } |
| 1316 | } |
| 1317 | |
| 1318 | #[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:)] |
| 1319 | enum CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind# { |
| 1320 | Utrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Ut#, |
| 1321 | Stdrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Std#, |
| 1322 | Leaprust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Leap#, |
| 1323 | Timerust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Time#, |
| 1324 | Typerust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Type#, |
| 1325 | Charrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Char#, |
| 1326 | } |
| 1327 | |
| 1328 | 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 CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind# { |
| 1329 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[CountKind][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# { |
| 1330 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::CountKindrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#::*; |
| 1331 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1332 | Utrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Ut# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("tzh_ttisutcnt"), |
| 1333 | Stdrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Std# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("tzh_ttisstdcnt"), |
| 1334 | Leaprust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Leap# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("tzh_leapcnt"), |
| 1335 | Timerust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Time# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("tzh_timecnt"), |
| 1336 | Typerust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Type# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("tzh_typecnt"), |
| 1337 | Charrust-analyzer cargo jiff 0.2.18 shared/tzif/CountKind#Char# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("tzh_charcnt"), |
| 1338 | } |
| 1339 | } |
| 1340 | } |
| 1341 | |
| 1342 | #[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:)] |
| 1343 | pub(craterust-analyzer cargo jiff 0.2.18 crate/) enum SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError# { |
| 1344 | V1rust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#V1#, |
| 1345 | LeapSecondsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#LeapSeconds#, |
| 1346 | LocalTimeTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#LocalTimeTypes#, |
| 1347 | StandardWallIndicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#StandardWallIndicators#, |
| 1348 | TimeZoneDesignationsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TimeZoneDesignations#, |
| 1349 | TransitionTimesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TransitionTimes#, |
| 1350 | TransitionTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TransitionTypes#, |
| 1351 | UTLocalIndicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#UTLocalIndicators#, |
| 1352 | } |
| 1353 | |
| 1354 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#> for TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1355 | fn fromrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[TzifError][`From<SplitAtError>`]from().(err: SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#) -> TzifErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifError# { |
| 1356 | TzifErrorKindrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#::SplitAtrust-analyzer cargo jiff 0.2.18 shared/tzif/TzifErrorKind#SplitAt#(err).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 1357 | } |
| 1358 | } |
| 1359 | |
| 1360 | 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 SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError# { |
| 1361 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[SplitAtError][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# { |
| 1362 | use selfrust-analyzer cargo jiff 0.2.18 shared/tzif/::SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#::*; |
| 1363 | |
| 1364 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected bytes for '")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1365 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 1366 | V1rust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#V1# => "v1 TZif", |
| 1367 | LeapSecondsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#LeapSeconds# => "leap seconds", |
| 1368 | LocalTimeTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#LocalTimeTypes# => "local time types", |
| 1369 | StandardWallIndicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#StandardWallIndicators# => "standard/wall indicators", |
| 1370 | TimeZoneDesignationsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TimeZoneDesignations# => "time zone designations", |
| 1371 | TransitionTimesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TransitionTimes# => "transition times", |
| 1372 | TransitionTypesrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#TransitionTypes# => "transition types", |
| 1373 | UTLocalIndicatorsrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#UTLocalIndicators# => "UT/local indicators", |
| 1374 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1375 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("data block', but did not find enough bytes")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1376 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1377 | } |
| 1378 | } |
| 1379 | |
| 1380 | #[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:)] |
| 1381 | struct U32UsizeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/U32UsizeError#; |
| 1382 | |
| 1383 | 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 U32UsizeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/U32UsizeError# { |
| 1384 | fn fmtrust-analyzer cargo jiff 0.2.18 shared/tzif/impl#[U32UsizeError][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# { |
| 1385 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 1386 | f, |
| 1387 | "failed to parse integer because it is bigger than `{max}`", |
| 1388 | max = usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX., |
| 1389 | ) |
| 1390 | } |
| 1391 | } |
| 1392 | |
| 1393 | /// Splits the given slice of bytes at the index given. |
| 1394 | /// |
| 1395 | /// If the index is out of range (greater than `bytes.len()`) then an error is |
| 1396 | /// returned. The error message will include the `what` string given, which is |
| 1397 | /// meant to describe the thing being split. |
| 1398 | fn try_split_atrust-analyzer cargo jiff 0.2.18 shared/tzif/try_split_at().<'b>( |
| 1399 | what: SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#, |
| 1400 | bytes: &'b [u8], |
| 1401 | at: usize, |
| 1402 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(&'b [u8], &'b [u8]), SplitAtErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/SplitAtError#> { |
| 1403 | if at rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 1404 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(what) |
| 1405 | } else { |
| 1406 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bytes.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(at)) |
| 1407 | } |
| 1408 | } |
| 1409 | |
| 1410 | /// Interprets the given slice as an unsigned 32-bit big endian integer, |
| 1411 | /// attempts to convert it to a `usize` and returns it. |
| 1412 | /// |
| 1413 | /// # Panics |
| 1414 | /// |
| 1415 | /// When `bytes.len() != 4`. |
| 1416 | /// |
| 1417 | /// # Errors |
| 1418 | /// |
| 1419 | /// This errors if the `u32` parsed from the given bytes cannot fit in a |
| 1420 | /// `usize`. |
| 1421 | fn from_be_bytes_u32_to_usizerust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32_to_usize().(bytes: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, U32UsizeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/U32UsizeError#> { |
| 1422 | let n = from_be_bytes_u32rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32().(bytes); |
| 1423 | usize::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[usize][`TryFrom<u32>`]try_from().(n).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| U32UsizeErrorrust-analyzer cargo jiff 0.2.18 shared/tzif/U32UsizeError#) |
| 1424 | } |
| 1425 | |
| 1426 | /// Interprets the given slice as an unsigned 32-bit big endian integer and |
| 1427 | /// returns it. |
| 1428 | /// |
| 1429 | /// # Panics |
| 1430 | /// |
| 1431 | /// When `bytes.len() != 4`. |
| 1432 | fn from_be_bytes_u32rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_u32().(bytes: &[u8]) -> u32 { |
| 1433 | u32::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_be_bytes().(bytes.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()) |
| 1434 | } |
| 1435 | |
| 1436 | /// Interprets the given slice as a signed 32-bit big endian integer and |
| 1437 | /// returns it. |
| 1438 | /// |
| 1439 | /// # Panics |
| 1440 | /// |
| 1441 | /// When `bytes.len() != 4`. |
| 1442 | fn from_be_bytes_i32rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i32().(bytes: &[u8]) -> i32 { |
| 1443 | i32::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]from_be_bytes().(bytes.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()) |
| 1444 | } |
| 1445 | |
| 1446 | /// Interprets the given slice as a signed 64-bit big endian integer and |
| 1447 | /// returns it. |
| 1448 | /// |
| 1449 | /// # Panics |
| 1450 | /// |
| 1451 | /// When `bytes.len() != 8`. |
| 1452 | fn from_be_bytes_i64rust-analyzer cargo jiff 0.2.18 shared/tzif/from_be_bytes_i64().(bytes: &[u8]) -> i64 { |
| 1453 | i64::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i64]from_be_bytes().(bytes.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()) |
| 1454 | } |