| 1 | /*! |
| 2 | This crate provides macros for defining `static` data structures for Jiff. |
| 3 | |
| 4 | The macros in this crate are re-exported in the [`jiff::tz`] sub-module. |
| 5 | Users should _not_ depend on this crate directly or import from it. Instead, |
| 6 | enable the `static` or `static-tz` features of Jiff and use the re-exports in |
| 7 | `jiff::tz`. |
| 8 | |
| 9 | At present, the macros in this crate are limited to creating `TimeZone` |
| 10 | in a `const` context. This works by reading TZif data (e.g., from |
| 11 | `/usr/share/zoneinfo/America/New_York` or from [`jiff-tzdb`]) at compile |
| 12 | time and generating Rust source code that builds a `TimeZone`. |
| 13 | |
| 14 | # Documentation |
| 15 | |
| 16 | The macros defined in this crate are documented on their corresponding |
| 17 | re-exports in Jiff: |
| 18 | |
| 19 | * `get` is documented at [`jiff::tz::get`]. |
| 20 | * `include` is documented at [`jiff::tz::include`]. |
| 21 | |
| 22 | # Compatibility |
| 23 | |
| 24 | The APIs required to build a `TimeZone` in a `const` context are exposed by |
| 25 | Jiff but not part of Jiff's public API for the purposes of semver (and do not |
| 26 | appear in `rustdoc`). The only guarantee provided by `jiff` and `jiff-static` |
| 27 | is that there is exactly one version of `jiff` that `jiff-static` works with. |
| 28 | Conventionally, this is indicated by the exact same version string. That is, |
| 29 | `jiff-static 0.2.2` is only guaranteed to work with `jiff 0.2.2`. |
| 30 | |
| 31 | This compatibility constraint is managed by Jiff, so that you should never |
| 32 | need to worry about it. In particular, users should never directly depend on |
| 33 | this crate. Everything should be managed through the `jiff` crate. |
| 34 | |
| 35 | [`jiff-tzdb`]: https://docs.rs/jiff-tzdb |
| 36 | [`jiff::tz`]: https://docs.rs/jiff/0.2/jiff/tz/index.html |
| 37 | [`jiff::tz::get`]: https://docs.rs/jiff/0.2/jiff/tz/macro.get.html |
| 38 | [`jiff::tz::include`]: https://docs.rs/jiff/0.2/jiff/tz/macro.include.html |
| 39 | */ |
| 40 | |
| 41 | extern crate allocrust-analyzer cargo jiff-static 0.2.16 alloc/; |
| 42 | extern crate proc_macrorust-analyzer cargo jiff-static 0.2.16 proc_macro/; |
| 43 | |
| 44 | use proc_macrorust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro crate/::TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#; |
| 45 | use quoterust-analyzer cargo quote 1.0.40 crate/::quoterust-analyzer cargo quote 1.0.40 quote!; |
| 46 | |
| 47 | use selfrust-analyzer cargo jiff-static 0.2.16 crate/::sharedrust-analyzer cargo jiff-static 0.2.16 shared/::{ |
| 48 | utilrust-analyzer cargo jiff-static 0.2.16 shared/util/::array_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/::Abbreviationrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/Abbreviation#, PosixDayrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#, PosixDayTimerust-analyzer cargo jiff-static 0.2.16 shared/PosixDayTime#, PosixDstrust-analyzer cargo jiff-static 0.2.16 shared/PosixDst#, |
| 49 | PosixOffsetrust-analyzer cargo jiff-static 0.2.16 shared/PosixOffset#, PosixRulerust-analyzer cargo jiff-static 0.2.16 shared/PosixRule#, PosixTimerust-analyzer cargo jiff-static 0.2.16 shared/PosixTime#, PosixTimeZonerust-analyzer cargo jiff-static 0.2.16 shared/PosixTimeZone#, TzifDateTimerust-analyzer cargo jiff-static 0.2.16 shared/TzifDateTime#, TzifFixedrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#, |
| 50 | TzifIndicatorrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#, TzifLocalTimeTyperust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType#, TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned#, TzifTransitionInforust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionInfo#, |
| 51 | TzifTransitionKindrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#, TzifTransitionsOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionsOwned#, |
| 52 | }; |
| 53 | |
| 54 | /// A bundle of code copied from `src/shared`. |
| 55 | /// |
| 56 | /// The main thing we use in here is the parsing routine for TZif data and |
| 57 | /// shared data types for representing TZif data. |
| 58 | /// |
| 59 | /// We also squash dead code warnings. This is somewhat precarious since |
| 60 | /// ideally we wouldn't compile what we don't need. But in practice, it's |
| 61 | /// annoying to get rid of everything we don't need in this context, and it |
| 62 | /// should be pretty small anyway. |
| 63 | #[allow(dead_code)] |
| 64 | mod sharedrust-analyzer cargo jiff-static 0.2.16 shared/; |
| 65 | |
| 66 | // Public API docs are in Jiff. |
| 67 | #[proc_macro] |
| 68 | pub fn includerust-analyzer cargo jiff-static 0.2.16 include!(input: TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#) -> TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream# { |
| 69 | let input = synrust-analyzer cargo syn 2.0.106 crate/::parse_macro_inputrust-analyzer cargo syn 2.0.106 parse_macro_input/parse_macro_input!!(input as Includerust-analyzer cargo jiff-static 0.2.16 Include#); |
| 70 | proc_macrorust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro crate/::TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#::fromrust-analyzer cargo proc-macro2 1.0.101 impl#[`proc_macro::TokenStream`][`From<TokenStream>`]from().(input.quoterust-analyzer cargo jiff-static 0.2.16 impl#[Include]quote().()) |
| 71 | } |
| 72 | |
| 73 | // Public API docs are in Jiff. |
| 74 | #[cfg(feature = "tzdb")] |
| 75 | #[proc_macro] |
| 76 | pub fn getrust-analyzer cargo jiff-static 0.2.16 get!(input: TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#) -> TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream# { |
| 77 | let input = synrust-analyzer cargo syn 2.0.106 crate/::parse_macro_inputrust-analyzer cargo syn 2.0.106 parse_macro_input/parse_macro_input!!(input as Getrust-analyzer cargo jiff-static 0.2.16 Get#); |
| 78 | proc_macrorust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro crate/::TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#::fromrust-analyzer cargo proc-macro2 1.0.101 impl#[`proc_macro::TokenStream`][`From<TokenStream>`]from().(input.quoterust-analyzer cargo jiff-static 0.2.16 impl#[Get]quote().()) |
| 79 | } |
| 80 | |
| 81 | /// The entry point for the `include!` macro. |
| 82 | #[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:)] |
| 83 | struct Includerust-analyzer cargo jiff-static 0.2.16 Include# { |
| 84 | tzifrust-analyzer cargo jiff-static 0.2.16 Include#tzif.: TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned#, |
| 85 | } |
| 86 | |
| 87 | impl Includerust-analyzer cargo jiff-static 0.2.16 Include# { |
| 88 | fn from_path_onlyrust-analyzer cargo jiff-static 0.2.16 impl#[Include]from_path_only().(path: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Includerust-analyzer cargo jiff-static 0.2.16 Include#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 89 | const NEEDLErust-analyzer cargo jiff-static 0.2.16 NEEDLE.: &str = "zoneinfo/"; |
| 90 | |
| 91 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(zoneinfo) = path.rfindrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]rfind().(NEEDLErust-analyzer cargo jiff-static 0.2.16 NEEDLE.) else { |
| 92 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 93 | "could not extract IANA time zone identifier from \ |
| 94 | file path `{path}` \ |
| 95 | (could not find `zoneinfo` in path), \ |
| 96 | please provide IANA time zone identifier as second \ |
| 97 | parameter", |
| 98 | )); |
| 99 | }; |
| 100 | let idstart = zoneinfo.saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(NEEDLErust-analyzer cargo jiff-static 0.2.16 NEEDLE..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()); |
| 101 | let id = &path[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().idstart..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().; |
| 102 | Includerust-analyzer cargo jiff-static 0.2.16 Include#::from_path_with_idrust-analyzer cargo jiff-static 0.2.16 impl#[Include]from_path_with_id().(id, path) |
| 103 | } |
| 104 | |
| 105 | fn from_path_with_idrust-analyzer cargo jiff-static 0.2.16 impl#[Include]from_path_with_id().(id: &str, path: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Includerust-analyzer cargo jiff-static 0.2.16 Include#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 106 | let id = id.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 107 | let data = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read().(path) |
| 108 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("failed to read {path}: {e}"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 109 | let tzif = TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned#::parserust-analyzer cargo jiff-static 0.2.16 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, Vec<TzifLocalTimeType>, Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]parse().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()), &data).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 110 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("failed to parse TZif data from {path}: {e}") |
| 111 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 112 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Includerust-analyzer cargo jiff-static 0.2.16 Include# { tzifrust-analyzer cargo jiff-static 0.2.16 Include#tzif. }) |
| 113 | } |
| 114 | |
| 115 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[Include]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 116 | self.tzifrust-analyzer cargo jiff-static 0.2.16 Include#tzif..quoterust-analyzer cargo jiff-static 0.2.16 impl#[`shared::Tzif<String, shared::util::array_str::ArrayStr<ABBREVIATION_MAX>, Vec<TzifLocalTimeType>, Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]quote().() |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | impl synrust-analyzer cargo syn 2.0.106 crate/::parserust-analyzer cargo syn 2.0.106 parse/::Parserust-analyzer cargo syn 2.0.106 parse/Parse# for Includerust-analyzer cargo jiff-static 0.2.16 Include# { |
| 121 | fn parserust-analyzer cargo jiff-static 0.2.16 impl#[Include][Parse]parse().(input: synrust-analyzer cargo syn 2.0.106 crate/::parserust-analyzer cargo syn 2.0.106 parse/::ParseStreamrust-analyzer cargo syn 2.0.106 parse/ParseStream#) -> synrust-analyzer cargo syn 2.0.106 crate/::Resultrust-analyzer cargo syn 2.0.106 error/Result#<Includerust-analyzer cargo jiff-static 0.2.16 Include#> { |
| 122 | let lit1 = input.parserust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]parse().::<synrust-analyzer cargo syn 2.0.106 crate/::LitStrrust-analyzer cargo syn 2.0.106 lit/LitStr#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..valuerust-analyzer cargo syn 2.0.106 lit/impl#[LitStr]value().(); |
| 123 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().input.lookahead1rust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]lookahead1().().peekrust-analyzer cargo syn 2.0.106 lookahead/impl#[`Lookahead1<'a>`]peek().(synrust-analyzer cargo syn 2.0.106 crate/::Tokenrust-analyzer cargo syn 2.0.106 token/Token!![,]) { |
| 124 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#( |
| 125 | Includerust-analyzer cargo jiff-static 0.2.16 Include#::from_path_onlyrust-analyzer cargo jiff-static 0.2.16 impl#[Include]from_path_only().(&lit1).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| input.errorrust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 126 | ); |
| 127 | } |
| 128 | input.parserust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]parse().::<synrust-analyzer cargo syn 2.0.106 crate/::Tokenrust-analyzer cargo syn 2.0.106 token/Token!![,]>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 129 | if input.is_emptyrust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]is_empty().() { |
| 130 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#( |
| 131 | Includerust-analyzer cargo jiff-static 0.2.16 Include#::from_path_onlyrust-analyzer cargo jiff-static 0.2.16 impl#[Include]from_path_only().(&lit1).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| input.errorrust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 132 | ); |
| 133 | } |
| 134 | let lit2 = input.parserust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]parse().::<synrust-analyzer cargo syn 2.0.106 crate/::LitStrrust-analyzer cargo syn 2.0.106 lit/LitStr#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..valuerust-analyzer cargo syn 2.0.106 lit/impl#[LitStr]value().(); |
| 135 | // Permit optional trailing comma. |
| 136 | if input.lookahead1rust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]lookahead1().().peekrust-analyzer cargo syn 2.0.106 lookahead/impl#[`Lookahead1<'a>`]peek().(synrust-analyzer cargo syn 2.0.106 crate/::Tokenrust-analyzer cargo syn 2.0.106 token/Token!![,]) { |
| 137 | input.parserust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]parse().::<synrust-analyzer cargo syn 2.0.106 crate/::Tokenrust-analyzer cargo syn 2.0.106 token/Token!![,]>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 138 | } |
| 139 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Includerust-analyzer cargo jiff-static 0.2.16 Include#::from_path_with_idrust-analyzer cargo jiff-static 0.2.16 impl#[Include]from_path_with_id().(&lit2, &lit1) |
| 140 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| input.errorrust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | /// The entry point for the `get!` macro. |
| 145 | #[cfg(feature = "tzdb")] |
| 146 | #[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:)] |
| 147 | struct Getrust-analyzer cargo jiff-static 0.2.16 Get# { |
| 148 | tzifrust-analyzer cargo jiff-static 0.2.16 Get#tzif.: TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned#, |
| 149 | } |
| 150 | |
| 151 | #[cfg(feature = "tzdb")] |
| 152 | impl Getrust-analyzer cargo jiff-static 0.2.16 Get# { |
| 153 | fn from_idrust-analyzer cargo jiff-static 0.2.16 impl#[Get]from_id().(id: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Getrust-analyzer cargo jiff-static 0.2.16 Get#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 154 | let (id, data) = jiff_tzdbrust-analyzer cargo jiff-tzdb 0.1.4 crate/::getrust-analyzer cargo jiff-tzdb 0.1.4 get().(id).ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| { |
| 155 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("could not find time zone `{id}` in bundled tzdb") |
| 156 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 157 | let id = id.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 158 | let tzif = TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned#::parserust-analyzer cargo jiff-static 0.2.16 shared/tzif/impl#[`super::Tzif<String, super::util::array_str::ArrayStr<ABBREVIATION_MAX>, Vec<TzifLocalTimeType>, Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]parse().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()), &data).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| { |
| 159 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("failed to parse TZif data from bundled `{id}`: {e}") |
| 160 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 161 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Getrust-analyzer cargo jiff-static 0.2.16 Get# { tzifrust-analyzer cargo jiff-static 0.2.16 Get#tzif. }) |
| 162 | } |
| 163 | |
| 164 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[Get]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 165 | self.tzifrust-analyzer cargo jiff-static 0.2.16 Get#tzif..quoterust-analyzer cargo jiff-static 0.2.16 impl#[`shared::Tzif<String, shared::util::array_str::ArrayStr<ABBREVIATION_MAX>, Vec<TzifLocalTimeType>, Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]quote().() |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | #[cfg(feature = "tzdb")] |
| 170 | impl synrust-analyzer cargo syn 2.0.106 crate/::parserust-analyzer cargo syn 2.0.106 parse/::Parserust-analyzer cargo syn 2.0.106 parse/Parse# for Getrust-analyzer cargo jiff-static 0.2.16 Get# { |
| 171 | fn parserust-analyzer cargo jiff-static 0.2.16 impl#[Get][Parse]parse().(input: synrust-analyzer cargo syn 2.0.106 crate/::parserust-analyzer cargo syn 2.0.106 parse/::ParseStreamrust-analyzer cargo syn 2.0.106 parse/ParseStream#) -> synrust-analyzer cargo syn 2.0.106 crate/::Resultrust-analyzer cargo syn 2.0.106 error/Result#<Getrust-analyzer cargo jiff-static 0.2.16 Get#> { |
| 172 | let lit1 = input.parserust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]parse().::<synrust-analyzer cargo syn 2.0.106 crate/::LitStrrust-analyzer cargo syn 2.0.106 lit/LitStr#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..valuerust-analyzer cargo syn 2.0.106 lit/impl#[LitStr]value().(); |
| 173 | if input.lookahead1rust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]lookahead1().().peekrust-analyzer cargo syn 2.0.106 lookahead/impl#[`Lookahead1<'a>`]peek().(synrust-analyzer cargo syn 2.0.106 crate/::Tokenrust-analyzer cargo syn 2.0.106 token/Token!![,]) { |
| 174 | input.parserust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]parse().::<synrust-analyzer cargo syn 2.0.106 crate/::Tokenrust-analyzer cargo syn 2.0.106 token/Token!![,]>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 175 | } |
| 176 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Getrust-analyzer cargo jiff-static 0.2.16 Get#::from_idrust-analyzer cargo jiff-static 0.2.16 impl#[Get]from_id().(&lit1).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| input.errorrust-analyzer cargo syn 2.0.106 parse/impl#[`ParseBuffer<'a>`]error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | // Everything below at this point is quasi-quoting the `shared` data type |
| 181 | // values into `static` data structures as Rust source code. |
| 182 | |
| 183 | impl TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned# { |
| 184 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[`shared::Tzif<String, shared::util::array_str::ArrayStr<ABBREVIATION_MAX>, Vec<TzifLocalTimeType>, Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 185 | let TzifOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifOwned# { ref fixedrust-analyzer cargo jiff-static 0.2.16 shared/Tzif#fixed., ref typesrust-analyzer cargo jiff-static 0.2.16 shared/Tzif#types., ref transitionsrust-analyzer cargo jiff-static 0.2.16 shared/Tzif#transitions. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 186 | let fixed = fixed.quoterust-analyzer cargo jiff-static 0.2.16 impl#[`TzifFixed<String, shared::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]quote().(); |
| 187 | let types = types.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(TzifLocalTimeTyperust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType#::quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifLocalTimeType]quote().); |
| 188 | let transitions = transitions.quoterust-analyzer cargo jiff-static 0.2.16 impl#[`shared::TzifTransitions<Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]quote().(); |
| 189 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 190 | { |
| 191 | static TZ: jiff::tz::TimeZone = |
| 192 | jiff::tz::TimeZone::__internal_from_tzif( |
| 193 | &jiff::shared::TzifStatic { |
| 194 | fixed: #fixed, |
| 195 | types: &[#(#types),*], |
| 196 | transitions: #transitions, |
| 197 | }.into_jiff() |
| 198 | ); |
| 199 | // SAFETY: Since we are guaranteed that the `TimeZone` is |
| 200 | // constructed above as a static TZif time zone, it follows |
| 201 | // that it is safe to memcpy's its internal representation. |
| 202 | // |
| 203 | // NOTE: We arrange things this way so that `jiff::tz::get!` |
| 204 | // can be used "by value" in most contexts. Basically, we |
| 205 | // "pin" the time zone to a static so that it has a guaranteed |
| 206 | // static lifetime. Otherwise, since `TimeZone` has a `Drop` |
| 207 | // impl, it's easy to run afoul of this and have it be dropped |
| 208 | // earlier than you like. Since this particular variant of |
| 209 | // `TimeZone` can always be memcpy'd internally, we just do |
| 210 | // this dance here to save the user from having to write out |
| 211 | // their own `static`. |
| 212 | // |
| 213 | // NOTE: It would be nice if we could make this `copy` routine |
| 214 | // safe, or at least panic if it's misused. But to do that, you |
| 215 | // need to know the time zone variant. And to know the time |
| 216 | // zone variant, you need to "look" at the tag in the pointer. |
| 217 | // And looking at the address of a pointer in a `const` context |
| 218 | // is precarious. |
| 219 | unsafe { TZ.copy() } |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | impl TzifFixedrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Abbreviationrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/Abbreviation#> { |
| 226 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[`TzifFixed<String, shared::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 227 | let TzifFixedrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed# { |
| 228 | ref namerust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#name., |
| 229 | versionrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#version., |
| 230 | checksumrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#checksum., |
| 231 | ref designationsrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#designations., |
| 232 | ref posix_tzrust-analyzer cargo jiff-static 0.2.16 shared/TzifFixed#posix_tz., |
| 233 | } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 234 | let name = name.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 235 | let posix_tz = posix_tz |
| 236 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 237 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|tz| { |
| 238 | let tz = tz.quoterust-analyzer cargo jiff-static 0.2.16 impl#[`PosixTimeZone<shared::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]quote().(); |
| 239 | quoterust-analyzer cargo quote 1.0.40 quote!!(Some(#tz)) |
| 240 | }) |
| 241 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| quoterust-analyzer cargo quote 1.0.40 quote!!(None)); |
| 242 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 243 | jiff::shared::TzifFixed { |
| 244 | name: Some(#name), |
| 245 | version: #version, |
| 246 | checksum: #checksum, |
| 247 | designations: #designations, |
| 248 | posix_tz: #posix_tz, |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | impl TzifTransitionsOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionsOwned# { |
| 255 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[`shared::TzifTransitions<Vec<i64>, Vec<TzifDateTime>, Vec<TzifDateTime>, Vec<TzifTransitionInfo>>`]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 256 | let TzifTransitionsOwnedrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionsOwned# { |
| 257 | ref timestampsrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitions#timestamps., |
| 258 | ref civil_startsrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitions#civil_starts., |
| 259 | ref civil_endsrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitions#civil_ends., |
| 260 | ref infosrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitions#infos., |
| 261 | } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 262 | let civil_starts: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = |
| 263 | civil_starts.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(TzifDateTimerust-analyzer cargo jiff-static 0.2.16 shared/TzifDateTime#::quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifDateTime]quote().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 264 | let civil_ends: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = |
| 265 | civil_ends.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(TzifDateTimerust-analyzer cargo jiff-static 0.2.16 shared/TzifDateTime#::quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifDateTime]quote().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 266 | let infos: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = |
| 267 | infos.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(TzifTransitionInforust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionInfo#::quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifTransitionInfo]quote().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 268 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 269 | jiff::shared::TzifTransitions { |
| 270 | timestamps: &[#(#timestamps),*], |
| 271 | civil_starts: &[#(#civil_starts),*], |
| 272 | civil_ends: &[#(#civil_ends),*], |
| 273 | infos: &[#(#infos),*], |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | impl TzifLocalTimeTyperust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType# { |
| 280 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifLocalTimeType]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 281 | let TzifLocalTimeTyperust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType# { |
| 282 | offsetrust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType#offset., |
| 283 | is_dstrust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType#is_dst., |
| 284 | ref designationrust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType#designation., |
| 285 | ref indicatorrust-analyzer cargo jiff-static 0.2.16 shared/TzifLocalTimeType#indicator., |
| 286 | } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 287 | let desig_start = designation.0; |
| 288 | let desig_end = designation.1; |
| 289 | let indicator = indicator.quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifIndicator]quote().(); |
| 290 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 291 | jiff::shared::TzifLocalTimeType { |
| 292 | offset: #offset, |
| 293 | is_dst: #is_dst, |
| 294 | designation: (#desig_start, #desig_end), |
| 295 | indicator: #indicator, |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | impl TzifIndicatorrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator# { |
| 302 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifIndicator]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 303 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 304 | TzifIndicatorrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#::LocalWallrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#LocalWall# => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 305 | jiff::shared::TzifIndicator::LocalWall |
| 306 | }, |
| 307 | TzifIndicatorrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#::LocalStandardrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#LocalStandard# => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 308 | jiff::shared::TzifIndicator::LocalStandard |
| 309 | }, |
| 310 | TzifIndicatorrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#::UTStandardrust-analyzer cargo jiff-static 0.2.16 shared/TzifIndicator#UTStandard# => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 311 | jiff::shared::TzifIndicator::UTStandard |
| 312 | }, |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | impl TzifTransitionInforust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionInfo# { |
| 318 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifTransitionInfo]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 319 | let TzifTransitionInforust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionInfo# { type_indexrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionInfo#type_index., kindrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionInfo#kind. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 320 | let kind = kind.quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifTransitionKind]quote().(); |
| 321 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 322 | jiff::shared::TzifTransitionInfo { |
| 323 | type_index: #type_index, |
| 324 | kind: #kind, |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | impl TzifTransitionKindrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind# { |
| 331 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifTransitionKind]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 332 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 333 | TzifTransitionKindrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#::Unambiguousrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#Unambiguous# => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 334 | jiff::shared::TzifTransitionKind::Unambiguous |
| 335 | }, |
| 336 | TzifTransitionKindrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#::Gaprust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#Gap# => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 337 | jiff::shared::TzifTransitionKind::Gap |
| 338 | }, |
| 339 | TzifTransitionKindrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#::Foldrust-analyzer cargo jiff-static 0.2.16 shared/TzifTransitionKind#Fold# => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 340 | jiff::shared::TzifTransitionKind::Fold |
| 341 | }, |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | impl TzifDateTimerust-analyzer cargo jiff-static 0.2.16 shared/TzifDateTime# { |
| 347 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[TzifDateTime]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 348 | let year = self.yearrust-analyzer cargo jiff-static 0.2.16 shared/impl#[TzifDateTime]year().(); |
| 349 | let month = self.monthrust-analyzer cargo jiff-static 0.2.16 shared/impl#[TzifDateTime]month().(); |
| 350 | let day = self.dayrust-analyzer cargo jiff-static 0.2.16 shared/impl#[TzifDateTime]day().(); |
| 351 | let hour = self.hourrust-analyzer cargo jiff-static 0.2.16 shared/impl#[TzifDateTime]hour().(); |
| 352 | let minute = self.minuterust-analyzer cargo jiff-static 0.2.16 shared/impl#[TzifDateTime]minute().(); |
| 353 | let second = self.secondrust-analyzer cargo jiff-static 0.2.16 shared/impl#[TzifDateTime]second().(); |
| 354 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 355 | jiff::shared::TzifDateTime::new( |
| 356 | #year, |
| 357 | #month, |
| 358 | #day, |
| 359 | #hour, |
| 360 | #minute, |
| 361 | #second, |
| 362 | ) |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | impl PosixTimeZonerust-analyzer cargo jiff-static 0.2.16 shared/PosixTimeZone#<Abbreviationrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/Abbreviation#> { |
| 368 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[`PosixTimeZone<shared::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 369 | let PosixTimeZonerust-analyzer cargo jiff-static 0.2.16 shared/PosixTimeZone# { ref std_abbrevrust-analyzer cargo jiff-static 0.2.16 shared/PosixTimeZone#std_abbrev., ref std_offsetrust-analyzer cargo jiff-static 0.2.16 shared/PosixTimeZone#std_offset., ref dstrust-analyzer cargo jiff-static 0.2.16 shared/PosixTimeZone#dst. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 370 | let std_abbrev = std_abbrev.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().(); |
| 371 | let std_offset = std_offset.quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixOffset]quote().(); |
| 372 | let dst = dst |
| 373 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 374 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|dst| { |
| 375 | let dst = dst.quoterust-analyzer cargo jiff-static 0.2.16 impl#[`PosixDst<shared::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]quote().(); |
| 376 | quoterust-analyzer cargo quote 1.0.40 quote!!(Some(#dst)) |
| 377 | }) |
| 378 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| quoterust-analyzer cargo quote 1.0.40 quote!!(None)); |
| 379 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 380 | jiff::shared::PosixTimeZone { |
| 381 | std_abbrev: #std_abbrev, |
| 382 | std_offset: #std_offset, |
| 383 | dst: #dst, |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | impl PosixDstrust-analyzer cargo jiff-static 0.2.16 shared/PosixDst#<Abbreviationrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/Abbreviation#> { |
| 390 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[`PosixDst<shared::util::array_str::ArrayStr<ABBREVIATION_MAX>>`]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 391 | let PosixDstrust-analyzer cargo jiff-static 0.2.16 shared/PosixDst# { ref abbrevrust-analyzer cargo jiff-static 0.2.16 shared/PosixDst#abbrev., ref offsetrust-analyzer cargo jiff-static 0.2.16 shared/PosixDst#offset., ref rulerust-analyzer cargo jiff-static 0.2.16 shared/PosixDst#rule. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 392 | let abbrev = abbrev.as_strrust-analyzer cargo jiff-static 0.2.16 shared/util/array_str/impl#[`ArrayStr<N>`]as_str().(); |
| 393 | let offset = offset.quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixOffset]quote().(); |
| 394 | let rule = rule.quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixRule]quote().(); |
| 395 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 396 | jiff::shared::PosixDst { |
| 397 | abbrev: #abbrev, |
| 398 | offset: #offset, |
| 399 | rule: #rule, |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | impl PosixRulerust-analyzer cargo jiff-static 0.2.16 shared/PosixRule# { |
| 406 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixRule]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 407 | let start = self.startrust-analyzer cargo jiff-static 0.2.16 shared/PosixRule#start..quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixDayTime]quote().(); |
| 408 | let end = self.endrust-analyzer cargo jiff-static 0.2.16 shared/PosixRule#end..quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixDayTime]quote().(); |
| 409 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 410 | jiff::shared::PosixRule { start: #start, end: #end } |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | impl PosixDayTimerust-analyzer cargo jiff-static 0.2.16 shared/PosixDayTime# { |
| 416 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixDayTime]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 417 | let PosixDayTimerust-analyzer cargo jiff-static 0.2.16 shared/PosixDayTime# { ref daterust-analyzer cargo jiff-static 0.2.16 shared/PosixDayTime#date., ref timerust-analyzer cargo jiff-static 0.2.16 shared/PosixDayTime#time. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 418 | let date = date.quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixDay]quote().(); |
| 419 | let time = time.quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixTime]quote().(); |
| 420 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 421 | jiff::shared::PosixDayTime { date: #date, time: #time } |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | impl PosixDayrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay# { |
| 427 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixDay]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 428 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 429 | PosixDayrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#::JulianOnerust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#JulianOne#(day) => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 430 | jiff::shared::PosixDay::JulianOne(#day) |
| 431 | }, |
| 432 | PosixDayrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#::JulianZerorust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#JulianZero#(day) => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 433 | jiff::shared::PosixDay::JulianZero(#day) |
| 434 | }, |
| 435 | PosixDayrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#::WeekdayOfMonthrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#WeekdayOfMonth# { monthrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#WeekdayOfMonth#month., weekrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#WeekdayOfMonth#week., weekdayrust-analyzer cargo jiff-static 0.2.16 shared/PosixDay#WeekdayOfMonth#weekday. } => quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 436 | jiff::shared::PosixDay::WeekdayOfMonth { |
| 437 | month: #month, |
| 438 | week: #week, |
| 439 | weekday: #weekday, |
| 440 | } |
| 441 | }, |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | impl PosixTimerust-analyzer cargo jiff-static 0.2.16 shared/PosixTime# { |
| 447 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixTime]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 448 | let PosixTimerust-analyzer cargo jiff-static 0.2.16 shared/PosixTime# { secondrust-analyzer cargo jiff-static 0.2.16 shared/PosixTime#second. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 449 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 450 | jiff::shared::PosixTime { second: #second } |
| 451 | } |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | impl PosixOffsetrust-analyzer cargo jiff-static 0.2.16 shared/PosixOffset# { |
| 456 | fn quoterust-analyzer cargo jiff-static 0.2.16 impl#[PosixOffset]quote().(&self) -> proc_macro2rust-analyzer cargo proc-macro2 1.0.101 crate/::TokenStreamrust-analyzer cargo proc-macro2 1.0.101 TokenStream# { |
| 457 | let PosixOffsetrust-analyzer cargo jiff-static 0.2.16 shared/PosixOffset# { secondrust-analyzer cargo jiff-static 0.2.16 shared/PosixOffset#second. } = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self; |
| 458 | quoterust-analyzer cargo quote 1.0.40 quote!! { |
| 459 | jiff::shared::PosixOffset { second: #second } |
| 460 | } |
| 461 | } |
| 462 | } |