From 124a28c016f1cf600bf8f9f134e88b8e5029e5fe Mon Sep 17 00:00:00 2001
From: _ <_@_>
Date: Sat, 3 May 2025 15:06:35 -0500
Subject: [PATCH] refactor
---
Cargo.lock | 900 ++++++++++++++++++++++-------------------
Cargo.toml | 14 +-
data/empire_city_2.xml | 185 +++++++++
data/sunset_city_2.xml | 171 ++++++++
examples/file.rs | 14 +
examples/reqwest.rs | 2 +-
src/dwml.rs | 247 +++++++++++
src/lib.rs | 197 +--------
8 files changed, 1127 insertions(+), 603 deletions(-)
create mode 100644 data/empire_city_2.xml
create mode 100644 data/sunset_city_2.xml
create mode 100644 examples/file.rs
create mode 100644 src/dwml.rs
diff --git a/Cargo.lock b/Cargo.lock
index 0c3fad8..5f47423 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -18,16 +18,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
-name = "anyhow"
-version = "1.0.95"
+name = "android-tzdata"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
-name = "atomic-waker"
-version = "1.1.2"
+name = "android_system_properties"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.98"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
[[package]]
name = "autocfg"
@@ -47,7 +56,7 @@ dependencies = [
"miniz_oxide",
"object",
"rustc-demangle",
- "windows-targets",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -58,27 +67,27 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bitflags"
-version = "2.7.0"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be"
+checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "bumpalo"
-version = "3.16.0"
+version = "3.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
[[package]]
name = "bytes"
-version = "1.9.0"
+version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
+checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]]
name = "cc"
-version = "1.2.9"
+version = "1.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b"
+checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0"
dependencies = [
"shlex",
]
@@ -90,13 +99,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
-name = "core-foundation"
-version = "0.9.4"
+name = "cfg_aliases"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
+
+[[package]]
+name = "chrono"
+version = "0.4.41"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
dependencies = [
- "core-foundation-sys",
- "libc",
+ "android-tzdata",
+ "iana-time-zone",
+ "js-sys",
+ "num-traits",
+ "wasm-bindgen",
+ "windows-link",
]
[[package]]
@@ -116,58 +135,12 @@ dependencies = [
"syn",
]
-[[package]]
-name = "encoding_rs"
-version = "0.8.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "equivalent"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
-
-[[package]]
-name = "errno"
-version = "0.3.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
-dependencies = [
- "libc",
- "windows-sys 0.59.0",
-]
-
-[[package]]
-name = "fastrand"
-version = "2.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
-
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-[[package]]
-name = "foreign-types"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
-dependencies = [
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
-
[[package]]
name = "form_urlencoded"
version = "1.2.1"
@@ -192,12 +165,6 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
-[[package]]
-name = "futures-sink"
-version = "0.3.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
-
[[package]]
name = "futures-task"
version = "0.3.31"
@@ -218,13 +185,29 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.15"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
+checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [
"cfg-if",
+ "js-sys",
"libc",
- "wasi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "r-efi",
+ "wasi 0.14.2+wasi-0.2.4",
+ "wasm-bindgen",
]
[[package]]
@@ -233,36 +216,11 @@ version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
-[[package]]
-name = "h2"
-version = "0.4.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
-dependencies = [
- "atomic-waker",
- "bytes",
- "fnv",
- "futures-core",
- "futures-sink",
- "http",
- "indexmap",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
-
-[[package]]
-name = "hashbrown"
-version = "0.15.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
-
[[package]]
name = "http"
-version = "1.2.0"
+version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea"
+checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
dependencies = [
"bytes",
"fnv",
@@ -281,12 +239,12 @@ dependencies = [
[[package]]
name = "http-body-util"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
+checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
dependencies = [
"bytes",
- "futures-util",
+ "futures-core",
"http",
"http-body",
"pin-project-lite",
@@ -294,20 +252,19 @@ dependencies = [
[[package]]
name = "httparse"
-version = "1.9.5"
+version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
[[package]]
name = "hyper"
-version = "1.5.2"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0"
+checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
- "h2",
"http",
"http-body",
"httparse",
@@ -333,29 +290,14 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
-]
-
-[[package]]
-name = "hyper-tls"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
-dependencies = [
- "bytes",
- "http-body-util",
- "hyper",
- "hyper-util",
- "native-tls",
- "tokio",
- "tokio-native-tls",
- "tower-service",
+ "webpki-roots",
]
[[package]]
name = "hyper-util"
-version = "0.1.10"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4"
+checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2"
dependencies = [
"bytes",
"futures-channel",
@@ -363,6 +305,7 @@ dependencies = [
"http",
"http-body",
"hyper",
+ "libc",
"pin-project-lite",
"socket2",
"tokio",
@@ -370,6 +313,30 @@ dependencies = [
"tracing",
]
+[[package]]
+name = "iana-time-zone"
+version = "0.1.63"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8"
+dependencies = [
+ "android_system_properties",
+ "core-foundation-sys",
+ "iana-time-zone-haiku",
+ "js-sys",
+ "log",
+ "wasm-bindgen",
+ "windows-core",
+]
+
+[[package]]
+name = "iana-time-zone-haiku"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
+dependencies = [
+ "cc",
+]
+
[[package]]
name = "icu_collections"
version = "1.5.0"
@@ -411,9 +378,9 @@ dependencies = [
[[package]]
name = "icu_locid_transform_data"
-version = "1.5.0"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e"
+checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d"
[[package]]
name = "icu_normalizer"
@@ -435,9 +402,9 @@ dependencies = [
[[package]]
name = "icu_normalizer_data"
-version = "1.5.0"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516"
+checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7"
[[package]]
name = "icu_properties"
@@ -456,9 +423,9 @@ dependencies = [
[[package]]
name = "icu_properties_data"
-version = "1.5.0"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569"
+checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2"
[[package]]
name = "icu_provider"
@@ -509,27 +476,17 @@ dependencies = [
"icu_properties",
]
-[[package]]
-name = "indexmap"
-version = "2.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
-dependencies = [
- "equivalent",
- "hashbrown",
-]
-
[[package]]
name = "ipnet"
-version = "2.10.1"
+version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
+checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
[[package]]
name = "itoa"
-version = "1.0.14"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
+checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "js-sys"
@@ -543,27 +500,21 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.169"
+version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
-
-[[package]]
-name = "linux-raw-sys"
-version = "0.4.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
+checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "litemap"
-version = "0.7.4"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
+checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
[[package]]
name = "log"
-version = "0.4.25"
+version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
+checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "memchr"
@@ -579,9 +530,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "miniz_oxide"
-version = "0.8.3"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924"
+checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
dependencies = [
"adler2",
]
@@ -593,25 +544,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
"libc",
- "wasi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.52.0",
]
[[package]]
-name = "native-tls"
-version = "0.2.12"
+name = "num-traits"
+version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
- "libc",
- "log",
- "openssl",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "security-framework",
- "security-framework-sys",
- "tempfile",
+ "autocfg",
]
[[package]]
@@ -625,53 +568,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.20.2"
+version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
-
-[[package]]
-name = "openssl"
-version = "0.10.68"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5"
-dependencies = [
- "bitflags",
- "cfg-if",
- "foreign-types",
- "libc",
- "once_cell",
- "openssl-macros",
- "openssl-sys",
-]
-
-[[package]]
-name = "openssl-macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "openssl-probe"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
-
-[[package]]
-name = "openssl-sys"
-version = "0.9.104"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "percent-encoding"
@@ -692,94 +591,184 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
-name = "pkg-config"
-version = "0.3.31"
+name = "ppv-lite86"
+version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
+dependencies = [
+ "zerocopy",
+]
[[package]]
name = "proc-macro2"
-version = "1.0.93"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
+checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quick-xml"
-version = "0.37.2"
+version = "0.37.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003"
+checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
dependencies = [
"memchr",
"serde",
]
[[package]]
-name = "quote"
-version = "1.0.38"
+name = "quinn"
+version = "0.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
+checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012"
+dependencies = [
+ "bytes",
+ "cfg_aliases",
+ "pin-project-lite",
+ "quinn-proto",
+ "quinn-udp",
+ "rustc-hash",
+ "rustls",
+ "socket2",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-proto"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bcbafbbdbb0f638fe3f35f3c56739f77a8a1d070cb25603226c83339b391472b"
+dependencies = [
+ "bytes",
+ "getrandom 0.3.2",
+ "rand",
+ "ring",
+ "rustc-hash",
+ "rustls",
+ "rustls-pki-types",
+ "slab",
+ "thiserror",
+ "tinyvec",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-udp"
+version = "0.5.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842"
+dependencies = [
+ "cfg_aliases",
+ "libc",
+ "once_cell",
+ "socket2",
+ "tracing",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
-name = "reqwest"
-version = "0.12.12"
+name = "r-efi"
+version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da"
+checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
+
+[[package]]
+name = "rand"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
+dependencies = [
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
+dependencies = [
+ "getrandom 0.3.2",
+]
+
+[[package]]
+name = "reqwest"
+version = "0.12.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb"
dependencies = [
"base64",
"bytes",
- "encoding_rs",
"futures-core",
"futures-util",
- "h2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-rustls",
- "hyper-tls",
"hyper-util",
"ipnet",
"js-sys",
"log",
"mime",
- "native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
+ "quinn",
+ "rustls",
"rustls-pemfile",
+ "rustls-pki-types",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper",
- "system-configuration",
"tokio",
- "tokio-native-tls",
+ "tokio-rustls",
"tower",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
+ "webpki-roots",
"windows-registry",
]
[[package]]
name = "ring"
-version = "0.17.8"
+version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
- "getrandom",
+ "getrandom 0.2.16",
"libc",
- "spin",
"untrusted",
"windows-sys 0.52.0",
]
@@ -791,25 +780,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
-name = "rustix"
-version = "0.38.43"
+name = "rustc-hash"
+version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
-dependencies = [
- "bitflags",
- "errno",
- "libc",
- "linux-raw-sys",
- "windows-sys 0.59.0",
-]
+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
[[package]]
name = "rustls"
-version = "0.23.21"
+version = "0.23.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8"
+checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0"
dependencies = [
"once_cell",
+ "ring",
"rustls-pki-types",
"rustls-webpki",
"subtle",
@@ -827,15 +810,18 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
-version = "1.10.1"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37"
+checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c"
+dependencies = [
+ "web-time",
+]
[[package]]
name = "rustls-webpki"
-version = "0.102.8"
+version = "0.103.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
+checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03"
dependencies = [
"ring",
"rustls-pki-types",
@@ -844,62 +830,30 @@ dependencies = [
[[package]]
name = "rustversion"
-version = "1.0.19"
+version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
+checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
[[package]]
name = "ryu"
-version = "1.0.18"
+version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
-
-[[package]]
-name = "schannel"
-version = "0.1.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
-dependencies = [
- "windows-sys 0.59.0",
-]
-
-[[package]]
-name = "security-framework"
-version = "2.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
-dependencies = [
- "bitflags",
- "core-foundation",
- "core-foundation-sys",
- "libc",
- "security-framework-sys",
-]
-
-[[package]]
-name = "security-framework-sys"
-version = "2.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
+checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "serde"
-version = "1.0.217"
+version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
+checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.217"
+version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
+checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
@@ -908,9 +862,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.135"
+version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
+checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [
"itoa",
"memchr",
@@ -947,26 +901,20 @@ dependencies = [
[[package]]
name = "smallvec"
-version = "1.13.2"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
[[package]]
name = "socket2"
-version = "0.5.8"
+version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8"
+checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
-[[package]]
-name = "spin"
-version = "0.9.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
-
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
@@ -981,9 +929,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
-version = "2.0.96"
+version = "2.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
+checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
dependencies = [
"proc-macro2",
"quote",
@@ -1001,9 +949,9 @@ dependencies = [
[[package]]
name = "synstructure"
-version = "0.13.1"
+version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
@@ -1011,38 +959,23 @@ dependencies = [
]
[[package]]
-name = "system-configuration"
-version = "0.6.1"
+name = "thiserror"
+version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
+checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
dependencies = [
- "bitflags",
- "core-foundation",
- "system-configuration-sys",
+ "thiserror-impl",
]
[[package]]
-name = "system-configuration-sys"
-version = "0.6.0"
+name = "thiserror-impl"
+version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "tempfile"
-version = "3.15.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704"
-dependencies = [
- "cfg-if",
- "fastrand",
- "getrandom",
- "once_cell",
- "rustix",
- "windows-sys 0.59.0",
+ "proc-macro2",
+ "quote",
+ "syn",
]
[[package]]
@@ -1056,10 +989,25 @@ dependencies = [
]
[[package]]
-name = "tokio"
-version = "1.43.0"
+name = "tinyvec"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
+checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.44.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
dependencies = [
"backtrace",
"bytes",
@@ -1082,39 +1030,16 @@ dependencies = [
"syn",
]
-[[package]]
-name = "tokio-native-tls"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
-dependencies = [
- "native-tls",
- "tokio",
-]
-
[[package]]
name = "tokio-rustls"
-version = "0.26.1"
+version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37"
+checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b"
dependencies = [
"rustls",
"tokio",
]
-[[package]]
-name = "tokio-util"
-version = "0.7.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078"
-dependencies = [
- "bytes",
- "futures-core",
- "futures-sink",
- "pin-project-lite",
- "tokio",
-]
-
[[package]]
name = "tower"
version = "0.5.2"
@@ -1169,9 +1094,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "unicode-ident"
-version = "1.0.14"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
+checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "untrusted"
@@ -1202,12 +1127,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
-[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
[[package]]
name = "want"
version = "0.3.1"
@@ -1223,6 +1142,15 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+[[package]]
+name = "wasi"
+version = "0.14.2+wasi-0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
+dependencies = [
+ "wit-bindgen-rt",
+]
+
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
@@ -1296,9 +1224,10 @@ dependencies = [
[[package]]
name = "weather_dot_gov_rs"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"anyhow",
+ "chrono",
"quick-xml",
"reqwest",
"serde",
@@ -1316,33 +1245,101 @@ dependencies = [
]
[[package]]
-name = "windows-registry"
-version = "0.2.0"
+name = "web-time"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "webpki-roots"
+version = "0.26.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37493cadf42a2a939ed404698ded7fb378bf301b5011f973361779a3a74f8c93"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[package]]
+name = "windows-core"
+version = "0.61.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
+dependencies = [
+ "windows-implement",
+ "windows-interface",
+ "windows-link",
+ "windows-result",
+ "windows-strings 0.4.0",
+]
+
+[[package]]
+name = "windows-implement"
+version = "0.60.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "windows-interface"
+version = "0.59.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "windows-link"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
+
+[[package]]
+name = "windows-registry"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3"
dependencies = [
"windows-result",
- "windows-strings",
- "windows-targets",
+ "windows-strings 0.3.1",
+ "windows-targets 0.53.0",
]
[[package]]
name = "windows-result"
-version = "0.2.0"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
+checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
- "windows-targets",
+ "windows-link",
]
[[package]]
name = "windows-strings"
-version = "0.1.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
+checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
dependencies = [
- "windows-result",
- "windows-targets",
+ "windows-link",
+]
+
+[[package]]
+name = "windows-strings"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
+dependencies = [
+ "windows-link",
]
[[package]]
@@ -1351,7 +1348,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-targets",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -1360,7 +1357,7 @@ version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
- "windows-targets",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -1369,14 +1366,30 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
- "windows_aarch64_gnullvm",
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_gnullvm",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_gnullvm",
- "windows_x86_64_msvc",
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm 0.52.6",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b"
+dependencies = [
+ "windows_aarch64_gnullvm 0.53.0",
+ "windows_aarch64_msvc 0.53.0",
+ "windows_i686_gnu 0.53.0",
+ "windows_i686_gnullvm 0.53.0",
+ "windows_i686_msvc 0.53.0",
+ "windows_x86_64_gnu 0.53.0",
+ "windows_x86_64_gnullvm 0.53.0",
+ "windows_x86_64_msvc 0.53.0",
]
[[package]]
@@ -1385,48 +1398,105 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
+
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
+
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
+
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
+
+[[package]]
+name = "wit-bindgen-rt"
+version = "0.39.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
+dependencies = [
+ "bitflags",
+]
+
[[package]]
name = "write16"
version = "1.0.0"
@@ -1464,19 +1534,39 @@ dependencies = [
]
[[package]]
-name = "zerofrom"
-version = "0.1.5"
+name = "zerocopy"
+version = "0.8.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
+checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.8.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
+checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [
"proc-macro2",
"quote",
diff --git a/Cargo.toml b/Cargo.toml
index f5c1845..c763425 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,18 +2,20 @@
name = "weather_dot_gov_rs"
description = "Parses DWML XML from forecast.weather.gov"
repository = "https://six-five-six-four.com/git/reactor/weather_dot_gov_rs"
-license = "AGPL-3.0"
-version = "0.1.0"
+# https://git.pixie.town/thufie/npl-builder/src/commit/a3dbbdb0ee3894c15ea2adb23ee2af6fdc9a1c09/cnpl.md
+license = "CNPL"
+version = "0.2.0"
edition = "2021"
readme = "README.md"
keywords = ["weather", "forecast", "dwml"]
[dependencies]
-quick-xml = { version = "0.37.2", features = ["overlapped-lists", "serialize"] }
-serde = { version = "1.0.217", features = ["derive"] }
+chrono = "0.4.41"
+quick-xml = { version = "0.37.5", features = ["overlapped-lists", "serialize"] }
+serde = { version = "1.0.219", features = ["derive"] }
[dev-dependencies]
anyhow = "1.0.95"
-reqwest = "0.12.12"
-tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
+reqwest = { version = "0.12.15", default-features = false, features = ["rustls-tls"] }
+tokio = { version = "1.44.2", features = ["macros", "rt"] }
diff --git a/data/empire_city_2.xml b/data/empire_city_2.xml
new file mode 100644
index 0000000..87f1635
--- /dev/null
+++ b/data/empire_city_2.xml
@@ -0,0 +1,185 @@
+
+
+
+
+ 2025-05-03T15:51:08-04:00
+ current observations and forecast
+
+
+ New York, NY
+ https://www.weather.gov/okx/
+ https://www.nws.noaa.gov/forecasts/xml/
+
+
+
+
+
+ point1
+ New York, NY
+
+ New York
+ 7
+
+https://forecast.weather.gov/MapClick.php?lat=40.71&lon=-74.01
+
+ k-p12h-n15-1
+ 2025-05-03T16:00:00-04:00
+ 2025-05-03T18:00:00-04:00
+ 2025-05-04T06:00:00-04:00
+ 2025-05-04T18:00:00-04:00
+ 2025-05-05T06:00:00-04:00
+ 2025-05-05T18:00:00-04:00
+ 2025-05-06T06:00:00-04:00
+ 2025-05-06T18:00:00-04:00
+ 2025-05-07T06:00:00-04:00
+ 2025-05-07T18:00:00-04:00
+ 2025-05-08T06:00:00-04:00
+ 2025-05-08T18:00:00-04:00
+ 2025-05-09T06:00:00-04:00
+ 2025-05-09T18:00:00-04:00
+ 2025-05-10T06:00:00-04:00
+
+
+
+ k-p24h-n8-1
+ 2025-05-03T16:00:00-04:00
+ 2025-05-04T06:00:00-04:00
+ 2025-05-05T06:00:00-04:00
+ 2025-05-06T06:00:00-04:00
+ 2025-05-07T06:00:00-04:00
+ 2025-05-08T06:00:00-04:00
+ 2025-05-09T06:00:00-04:00
+ 2025-05-10T06:00:00-04:00
+
+
+
+ k-p24h-n7-2
+ 2025-05-03T18:00:00-04:00
+ 2025-05-04T18:00:00-04:00
+ 2025-05-05T18:00:00-04:00
+ 2025-05-06T18:00:00-04:00
+ 2025-05-07T18:00:00-04:00
+ 2025-05-08T18:00:00-04:00
+ 2025-05-09T18:00:00-04:00
+
+
+
+
+
+
+ Daily Maximum Temperature
+ 79
+ 72
+ 62
+ 64
+ 69
+ 66
+ 59
+ 67
+
+
+
+ Daily Minimum Temperature
+ 61
+ 57
+ 60
+ 59
+ 59
+ 52
+ 52
+
+
+
+ 12 Hourly Probability of Precipitation
+ 60
+ 80
+ 60
+ 60
+ 90
+ 90
+ 90
+ 50
+
+
+ 40
+ 40
+ 30
+ 30
+
+
+
+
+ Weather Type, Coverage, Intensity
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Conditions Icon https://forecast.weather.gov/newimages/medium/shra60.png
+ https://forecast.weather.gov/DualImage.php?i=nshra&j=ntsra&ip=80&jp=30
+ https://forecast.weather.gov/DualImage.php?i=shra&j=shra&ip=30&jp=60
+ https://forecast.weather.gov/newimages/medium/nshra60.png
+ https://forecast.weather.gov/newimages/medium/shra90.png
+ https://forecast.weather.gov/newimages/medium/nshra90.png
+ https://forecast.weather.gov/newimages/medium/shra90.png
+ https://forecast.weather.gov/DualImage.php?i=nscttsra&j=nshra&ip=50&jp=50
+ https://forecast.weather.gov/newimages/medium/sct.png
+ https://forecast.weather.gov/newimages/medium/nsct.png
+ https://forecast.weather.gov/DualImage.php?i=bkn&j=shra&jp=40
+ https://forecast.weather.gov/newimages/medium/nshra40.png
+ https://forecast.weather.gov/newimages/medium/shra30.png
+ https://forecast.weather.gov/newimages/medium/hi_nshwrs30.png
+ https://forecast.weather.gov/newimages/medium/sct.png
+
+
+
+ Watches, Warnings, and Advisories
+
+
+ https://forecast.weather.gov/showsigwx.php?warnzone=NYZ072&warncounty=NYC061&firewxzone=NYZ212&local_place1=New+York+NY&product1=Hazardous+Weather+Outlook
+
+
+
+
+
+ Text Forecast
+ A slight chance of showers and thunderstorms, then showers likely and possibly a thunderstorm after 5pm. Partly sunny, with a steady temperature around 79. South wind around 14 mph, with gusts as high as 25 mph. Chance of precipitation is 60%. New rainfall amounts of less than a tenth of an inch, except higher amounts possible in thunderstorms.
+ Showers and possibly a thunderstorm before 11pm, then a chance of showers and thunderstorms between 11pm and 2am, then a slight chance of showers after 2am. Low around 61. South wind around 10 mph. Chance of precipitation is 80%. New rainfall amounts between a tenth and quarter of an inch, except higher amounts possible in thunderstorms.
+ A chance of showers, then showers likely and possibly a thunderstorm after 2pm. Cloudy, with a high near 72. South wind 9 to 14 mph. Chance of precipitation is 60%. New rainfall amounts of less than a tenth of an inch, except higher amounts possible in thunderstorms.
+ Showers likely and possibly a thunderstorm. Cloudy, with a low around 57. East wind 9 to 11 mph. Chance of precipitation is 60%. New precipitation amounts between a quarter and half of an inch possible.
+ Showers, with thunderstorms also possible after 2pm. High near 62. East wind 11 to 14 mph. Chance of precipitation is 90%. New rainfall amounts between a half and three quarters of an inch possible.
+ Showers, with thunderstorms also possible after 2am. Low around 60. Chance of precipitation is 90%. New rainfall amounts between a half and three quarters of an inch possible.
+ Showers and possibly a thunderstorm before 8am, then showers between 8am and 2pm, then showers and possibly a thunderstorm after 2pm. High near 64. Chance of precipitation is 90%.
+ A chance of showers and thunderstorms before 8pm, then a chance of showers between 8pm and 2am. Mostly cloudy, with a low around 59. Chance of precipitation is 50%.
+ Mostly sunny, with a high near 69.
+ Partly cloudy, with a low around 59.
+ A 40 percent chance of showers. Partly sunny, with a high near 66.
+ A 40 percent chance of showers. Mostly cloudy, with a low around 52.
+ A 30 percent chance of showers. Partly sunny, with a high near 59.
+ A 30 percent chance of showers. Partly cloudy, with a low around 52.
+ Mostly sunny, with a high near 67.
+
+
+
+
+
+
+ point1
+
+ New York City, Central Park, NY
+ 154
+
+ https://www.nws.noaa.gov/data/obhistory/KNYC.html k-p1h-n1-1 2025-05-03T15:51:00-04:00 84 56 38 Weather Type, Coverage, Intensity 10.00 Conditions Icon https://forecast.weather.gov/newimages/medium/sct.png NA NA NA 29.82
\ No newline at end of file
diff --git a/data/sunset_city_2.xml b/data/sunset_city_2.xml
new file mode 100644
index 0000000..e19e234
--- /dev/null
+++ b/data/sunset_city_2.xml
@@ -0,0 +1,171 @@
+
+
+
+
+ 2025-05-03T13:27:14-07:00
+ current observations and forecast
+
+
+ San Francisco Bay Area/Monterey, CA
+ https://www.weather.gov/mtr
+ https://www.nws.noaa.gov/forecasts/xml/
+
+
+
+
+
+ point1
+ San Francisco, CA
+
+ San Francisco
+ 131
+
+https://forecast.weather.gov/MapClick.php?lat=37.77&lon=-122.41
+
+ k-p12h-n13-1
+ 2025-05-03T13:00:00-07:00
+ 2025-05-03T18:00:00-07:00
+ 2025-05-04T06:00:00-07:00
+ 2025-05-04T18:00:00-07:00
+ 2025-05-05T06:00:00-07:00
+ 2025-05-05T18:00:00-07:00
+ 2025-05-06T06:00:00-07:00
+ 2025-05-06T18:00:00-07:00
+ 2025-05-07T06:00:00-07:00
+ 2025-05-07T18:00:00-07:00
+ 2025-05-08T06:00:00-07:00
+ 2025-05-08T18:00:00-07:00
+ 2025-05-09T06:00:00-07:00
+
+
+
+ k-p24h-n7-1
+ 2025-05-03T13:00:00-07:00
+ 2025-05-04T06:00:00-07:00
+ 2025-05-05T06:00:00-07:00
+ 2025-05-06T06:00:00-07:00
+ 2025-05-07T06:00:00-07:00
+ 2025-05-08T06:00:00-07:00
+ 2025-05-09T06:00:00-07:00
+
+
+
+ k-p24h-n6-2
+ 2025-05-03T18:00:00-07:00
+ 2025-05-04T18:00:00-07:00
+ 2025-05-05T18:00:00-07:00
+ 2025-05-06T18:00:00-07:00
+ 2025-05-07T18:00:00-07:00
+ 2025-05-08T18:00:00-07:00
+
+
+
+
+
+
+ Daily Maximum Temperature
+ 62
+ 67
+ 76
+ 69
+ 65
+ 67
+ 67
+
+
+
+ Daily Minimum Temperature
+ 50
+ 55
+ 53
+ 52
+ 51
+ 50
+
+
+
+ 12 Hourly Probability of Precipitation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Weather Type, Coverage, Intensity
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Conditions Icon https://forecast.weather.gov/newimages/medium/wind_sct.png
+ https://forecast.weather.gov/newimages/medium/nfew.png
+ https://forecast.weather.gov/newimages/medium/skc.png
+ https://forecast.weather.gov/newimages/medium/nskc.png
+ https://forecast.weather.gov/newimages/medium/skc.png
+ https://forecast.weather.gov/newimages/medium/nskc.png
+ https://forecast.weather.gov/newimages/medium/few.png
+ https://forecast.weather.gov/newimages/medium/nsct.png
+ https://forecast.weather.gov/newimages/medium/sct.png
+ https://forecast.weather.gov/newimages/medium/nsct.png
+ https://forecast.weather.gov/newimages/medium/sct.png
+ https://forecast.weather.gov/newimages/medium/nsct.png
+ https://forecast.weather.gov/newimages/medium/few.png
+
+
+
+ Watches, Warnings, and Advisories
+
+
+ https://forecast.weather.gov/showsigwx.php?warnzone=CAZ006&warncounty=CAC075&firewxzone=CAZ006&local_place1=San+Francisco+CA&product1=Wind+Advisory
+
+
+
+
+
+ Text Forecast
+ Mostly sunny, with a high near 62. Breezy, with a west wind 21 to 23 mph, with gusts as high as 30 mph.
+ Mostly clear, with a low around 50. West northwest wind 15 to 20 mph decreasing to 9 to 14 mph after midnight. Winds could gust as high as 29 mph.
+ Sunny, with a high near 67. West wind 7 to 17 mph, with gusts as high as 21 mph.
+ Clear, with a low around 55. West wind 8 to 15 mph, with gusts as high as 28 mph.
+ Sunny, with a high near 76. North wind 7 to 13 mph, with gusts as high as 25 mph.
+ Clear, with a low around 53.
+ Sunny, with a high near 69.
+ Partly cloudy, with a low around 52.
+ Mostly sunny, with a high near 65.
+ Partly cloudy, with a low around 51.
+ Mostly sunny, with a high near 67.
+ Partly cloudy, with a low around 50.
+ Sunny, with a high near 67.
+
+
+
+
+
+
+ point1
+
+ SAN FRANCISCO DOWNTOWN, CA
+ 150.0
+
+ https://www.weather.gov/wrh/LocalWeather?wfo=mtr&zone=CAZ006 k-p1h-n1-1 2025-05-03T13:30:00 57 46 67 Weather Type, Coverage, Intensity NA Conditions Icon NULL NA NA NA NA
\ No newline at end of file
diff --git a/examples/file.rs b/examples/file.rs
new file mode 100644
index 0000000..aed9d08
--- /dev/null
+++ b/examples/file.rs
@@ -0,0 +1,14 @@
+use anyhow::{Context as _, Result};
+use std::str::FromStr as _;
+
+fn main() -> Result<()> {
+ let mut args = std::env::args();
+ args.next().unwrap();
+
+ let path = args.next().context("Usage: cargo run --example file -- untracked/data.xml")?;
+ let s = std::fs::read_to_string(&path)?;
+ let dwml = weather_dot_gov_rs::Dwml::from_str(&s)?;
+
+ println!("{dwml:#?}");
+ Ok(())
+}
diff --git a/examples/reqwest.rs b/examples/reqwest.rs
index cd63f04..4dcac5f 100644
--- a/examples/reqwest.rs
+++ b/examples/reqwest.rs
@@ -1,7 +1,7 @@
use anyhow::{Context as _, Result};
use std::str::FromStr as _;
-#[tokio::main]
+#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let mut args = std::env::args();
args.next().context("Expected app name as arg0")?;
diff --git a/src/dwml.rs b/src/dwml.rs
new file mode 100644
index 0000000..301b333
--- /dev/null
+++ b/src/dwml.rs
@@ -0,0 +1,247 @@
+//! Encapsulates the DWML implementation details
+
+use chrono::FixedOffset;
+use serde::Deserialize;
+
+/// Top-level structure
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Dwml {
+ pub head: Head,
+ pub data: (Forecast, CurrentObservations),
+}
+
+impl std::str::FromStr for Dwml {
+ type Err = quick_xml::DeError;
+
+ fn from_str(s: &str) -> Result {
+ quick_xml::de::from_str(s)
+ }
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Head {
+ pub product: Product,
+ pub source: Source,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Forecast {
+ pub location: Location,
+ #[serde(rename = "time-layout")]
+ pub time_layout: (TimeLayout, TimeLayout, TimeLayout),
+ pub parameters: Parameters,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Location {
+ #[serde(rename = "area-description")]
+ pub area_description: Option,
+ pub description: Option,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct TimeLayout {
+ #[serde(rename = "@time-coordinate")]
+ pub time_coordinate: TimeCoordinate,
+
+ #[serde(rename = "layout-key")]
+ pub layout_key: TimeLayoutKey,
+
+ #[serde(rename = "start-valid-time")]
+ pub start_valid_time: Vec,
+}
+
+impl TimeLayout {
+ /// For a given time, returns the index of the interval that the time falls in.
+ fn lookup(&self, t: &chrono::DateTime) -> Option {
+ for i in 0..self.start_valid_time.len() - 1 {
+ let Some(start) = self.start_valid_time.get(i) else {
+ break;
+ };
+ let Some(stop) = self.start_valid_time.get(i + 1) else {
+ break;
+ };
+ if start.value.0 <= *t && *t < stop.value.0 {
+ return Some(i);
+ }
+ }
+ None
+ }
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub enum TimeCoordinate {
+ #[serde(rename = "local")]
+ Local,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct StartValidTime {
+ #[serde(rename = "@period-name")]
+ pub period_name: String,
+
+ #[serde(rename = "$value")]
+ pub value: DateTime,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+#[serde(try_from = "String")]
+pub struct DateTime (pub chrono::DateTime);
+impl TryFrom for DateTime {
+ type Error = chrono::ParseError;
+
+ fn try_from(s: String) -> Result {
+ chrono::DateTime::parse_from_rfc3339(&s).map(Self)
+ }
+}
+
+/// Observations at time of request
+///
+/// Note that `time-layout` isn't parsed because in San Franscisco it returns a time with no timezone, which makes the schema too complicated. It's in local California time, so we could graft on a timezone from another part of the XML, but why bother.
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct CurrentObservations {
+ pub location: Location,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Product {
+ #[serde(rename = "creation-date")]
+ pub creation_date: CreationDate,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct CreationDate {
+ #[serde(rename = "@refresh-frequency")]
+ pub refresh_frequency: String,
+
+ #[serde(rename = "$value")]
+ pub value: String,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Source {
+ #[serde(rename = "production-center")]
+ pub production_center: String,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Parameters {
+ pub temperature: (Temperature, Temperature),
+
+ #[serde(rename = "probability-of-precipitation")]
+ pub probability_of_precipitation: ProbabilityOfPrecipitation,
+
+ pub weather: Weather,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Temperature {
+ #[serde(rename = "@type")]
+ pub temp_type: TempType,
+
+ #[serde(rename = "@units")]
+ pub units: TempUnits,
+
+ #[serde(rename = "@time-layout")]
+ pub time_layout: TimeLayoutKey,
+
+ pub value: Vec,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct ProbabilityOfPrecipitation {
+ #[serde(rename = "@time-layout")]
+ pub time_layout: TimeLayoutKey,
+
+ pub value: Vec,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct Weather {
+ #[serde(rename = "@time-layout")]
+ pub time_layout: TimeLayoutKey,
+
+ #[serde(rename = "weather-conditions")]
+ pub weather_conditions: Vec,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct WeatherCondition {
+ /// e.g. "Showers Likely" or "Partly Sunny"
+ #[serde(rename = "@weather-summary")]
+ pub weather_summary: String,
+}
+
+// If only there was a percentage that could convey the concept of
+// no precipitation.
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct PrecipitationValue {
+ #[serde(rename = "$text")]
+ pub value: Option,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub enum TempType {
+ #[serde(rename = "apparent")]
+ Apparent,
+ #[serde(rename = "dew point")]
+ DewPoint,
+ #[serde(rename = "minimum")]
+ Minimum,
+ #[serde(rename = "maximum")]
+ Maximum,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub enum TempUnits {
+ Celsius,
+ Fahrenheit,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+pub struct TimeLayoutKey(String);
+
+#[cfg(test)]
+mod tests {
+ use anyhow::{Context as _, Result};
+ use super::*;
+
+ #[test]
+ fn empire_city() {
+ let s = include_str!("../data/empire_city.xml");
+ let dwml: Dwml = quick_xml::de::from_str(s).unwrap();
+
+ for (input, expected) in [
+ ("2025-01-14T18:59:59-05:00", None),
+ ("2025-01-14T19:00:00-05:00", Some(0)),
+ ("2025-01-21T05:59:59-05:00", Some(12)),
+ ("2025-01-21T06:00:00-05:00", None),
+ ] {
+ let dt = chrono::DateTime::parse_from_rfc3339(input).unwrap();
+ let actual = dwml.data.0.time_layout.0.lookup(&dt);
+ assert_eq!(actual, expected);
+ }
+ }
+
+ #[test]
+ fn sunset_city() {
+ let s = include_str!("../data/sunset_city.xml");
+ let _: Dwml = quick_xml::de::from_str(s).unwrap();
+ }
+
+ #[test]
+ fn windy_city() {
+ let s = include_str!("../data/windy_city.xml");
+ let _: Dwml = quick_xml::de::from_str(s).unwrap();
+ }
+
+ #[test]
+ fn date() -> Result<()> {
+ for s in [
+ "2025-01-01T23:00:00-00:00"
+ ] {
+ let _ = chrono::DateTime::parse_from_rfc3339(&s).context(s).unwrap();
+ }
+ Ok(())
+ }
+}
diff --git a/src/lib.rs b/src/lib.rs
index b98c25f..ce13441 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,193 +1,8 @@
-use serde::Deserialize;
+//! Parses the DWML machine-readable format produced by forecast.weather.gov.
+//!
+//! Try `cargo run --example reqwest 40.71 -74.01`
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Dwml {
- pub head: Head,
- pub data: (Forecast, CurrentObservations),
-}
+pub mod dwml;
-impl std::str::FromStr for Dwml {
- type Err = quick_xml::DeError;
-
- fn from_str(s: &str) -> Result {
- quick_xml::de::from_str(s)
- }
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Head {
- pub product: Product,
- pub source: Source,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Forecast {
- pub location: Location,
- #[serde(rename = "time-layout")]
- pub time_layout: (TimeLayout, TimeLayout, TimeLayout),
- pub parameters: Parameters,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Location {
- #[serde(rename = "area-description")]
- pub area_description: Option,
- pub description: Option,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct TimeLayout {
- #[serde(rename = "@time-coordinate")]
- pub time_coordinate: TimeCoordinate,
-
- #[serde(rename = "layout-key")]
- pub layout_key: LayoutKey,
-
- #[serde(rename = "start-valid-time")]
- pub start_valid_time: Vec,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub enum TimeCoordinate {
- #[serde(rename = "local")]
- Local,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub enum LayoutKey {
- #[serde(rename = "k-p12h-n14-1")]
- K12Hourly,
- #[serde(rename = "k-p24h-n7-1")]
- K24Hourly1,
- #[serde(rename = "k-p24h-n7-2")]
- K24Hourly2,
- #[serde(rename = "k-p1h-n1-1")]
- K1Hour,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct StartValidTime {
- #[serde(rename = "@period-name")]
- pub period_name: String,
-
- #[serde(rename = "$value")]
- pub value: String,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct CurrentObservations {
- pub location: Location,
- #[serde(rename = "time-layout")]
- pub time_layout: TimeLayout,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Product {
- #[serde(rename = "creation-date")]
- pub creation_date: CreationDate,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct CreationDate {
- #[serde(rename = "@refresh-frequency")]
- pub refresh_frequency: String,
-
- #[serde(rename = "$value")]
- pub value: String,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Source {
- #[serde(rename = "production-center")]
- pub production_center: String,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Parameters {
- pub temperature: (Temperature, Temperature),
-
- #[serde(rename = "probability-of-precipitation")]
- pub probability_of_precipitation: ProbabilityOfPrecipitation,
-
- pub weather: Weather,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Temperature {
- #[serde(rename = "@type")]
- pub temp_type: TempType,
-
- #[serde(rename = "@units")]
- pub units: TempUnits,
-
- #[serde(rename = "@time-layout")]
- pub time_layout: LayoutKey,
-
- pub value: Vec,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct ProbabilityOfPrecipitation {
- #[serde(rename = "@time-layout")]
- pub time_layout: LayoutKey,
-
- pub value: Vec,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct Weather {
- #[serde(rename = "@time-layout")]
- pub time_layout: LayoutKey,
-
- #[serde(rename = "weather-conditions")]
- pub weather_conditions: Vec,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct WeatherCondition {
- #[serde(rename = "@weather-summary")]
- pub weather_summary: String,
-}
-
-// If only there was a percentage that could convey the concept of
-// no precipitation.
-#[derive(Debug, Deserialize, PartialEq)]
-pub struct PrecipitationValue {
- #[serde(rename = "$text")]
- pub value: Option,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub enum TempType {
- #[serde(rename = "apparent")]
- Apparent,
- #[serde(rename = "dew point")]
- DewPoint,
- #[serde(rename = "minimum")]
- Minimum,
- #[serde(rename = "maximum")]
- Maximum,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-pub enum TempUnits {
- Celsius,
- Fahrenheit,
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn parse() {
- let s = include_str!("../data/empire_city.xml");
- let _: Dwml = quick_xml::de::from_str(s).unwrap();
-
- let s = include_str!("../data/sunset_city.xml");
- let _: Dwml = quick_xml::de::from_str(s).unwrap();
-
- let s = include_str!("../data/windy_city.xml");
- let _: Dwml = quick_xml::de::from_str(s).unwrap();
- }
-}
+/// Top-level structure for parsed data
+pub use dwml::Dwml;