From c1de33934534d5c811398cb067c7c81907864a65 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Tue, 31 Mar 2026 11:45:42 -0400 Subject: [PATCH 01/10] Add one point past the decimal for UV value --- src/display/formatter.rs | 14 +++++++------- src/models.rs | 2 +- src/tests.rs | 1 - src/weather/openuv.rs | 4 ++-- src/weather/tomorrow_io.rs | 4 ++-- src/weather/weather_api.rs | 6 +++--- src/weather/weather_bit.rs | 6 +++--- src/weather/world_weather_online.rs | 4 ++-- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/display/formatter.rs b/src/display/formatter.rs index 42f3f51..b5ca745 100644 --- a/src/display/formatter.rs +++ b/src/display/formatter.rs @@ -169,7 +169,7 @@ impl WeatherFormatter { icon[1], "Condition", if let Some(uv) = weather.uv_index { - format!("{} ({} {uv})", weather.description, ll(lang, "UV index")) + format!("{} ({} {uv:.1})", weather.description, ll(lang, "UV index")) } else { weather.description }, @@ -480,15 +480,15 @@ mod tests { #[test] fn test_uv_index() { let mut weather = sample_weather(); - weather.uv_index = Some(7); + weather.uv_index = Some(7.2); let config = Config::default(); let formatter = WeatherFormatter::new(&config); let lines = formatter.format_text(weather); assert_eq!(lines.len(), 7); assert!( - lines[1].contains("UV index 7"), - "Expected 'UV index 7' in condition line, got '{}'", + lines[1].contains("UV index 7.2"), + "Expected 'UV index 7.2' in condition line, got '{}'", lines[1] ); } @@ -738,15 +738,15 @@ mod tests { #[test] fn test_uv_index_display() { let mut weather = sample_weather(); - weather.uv_index = Some(5); + weather.uv_index = Some(5.); let config = Config::default(); let formatter = WeatherFormatter::new(&config); let lines = formatter.format_text(weather); assert_eq!(lines.len(), 7); assert!( - lines[1].contains("UV index 5"), - "Expected 'UV index 5' in condition line, got '{}'", + lines[1].contains("UV index 5.0"), + "Expected 'UV index 5.0' in condition line, got '{}'", lines[1] ); } diff --git a/src/models.rs b/src/models.rs index 59856db..70c6065 100644 --- a/src/models.rs +++ b/src/models.rs @@ -93,7 +93,7 @@ pub struct Weather { pub pressure: u32, pub wind_speed: f64, pub wind_direction: u16, - pub uv_index: Option, + pub uv_index: Option, pub description: String, pub icon: WeatherConditionIcon, pub location_name: String, diff --git a/src/tests.rs b/src/tests.rs index 1251392..0acd658 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,4 +1,3 @@ -#![cfg(test)] use crate::models::Location; use crate::weather::{LookUpCity, tools}; use crate::{ diff --git a/src/weather/openuv.rs b/src/weather/openuv.rs index 68b0070..767feb1 100644 --- a/src/weather/openuv.rs +++ b/src/weather/openuv.rs @@ -36,7 +36,7 @@ pub fn get_uv_index( client: &Client, config: &Config, location: &Location, -) -> Result, RustormyError> { +) -> Result, RustormyError> { if config.api_keys().open_uv.is_empty() { return Ok(None); } @@ -48,7 +48,7 @@ pub fn get_uv_index( .send()?; let data: UvResponse = response.json()?; match data { - UvResponse::Ok { result } => Ok(Some(result.uv.round() as u8)), + UvResponse::Ok { result } => Ok(Some((result.uv * 10.).round() / 10.)), UvResponse::Err { message } => Err(RustormyError::ApiReturnedError(message)), } } diff --git a/src/weather/tomorrow_io.rs b/src/weather/tomorrow_io.rs index e2bbb43..05489f3 100644 --- a/src/weather/tomorrow_io.rs +++ b/src/weather/tomorrow_io.rs @@ -65,7 +65,7 @@ struct WeatherValues { pressure_surface_level: f64, wind_speed: f64, wind_direction: u16, - uv_index: u8, + uv_index: f64, weather_code: u16, dew_point: f64, // pressure_sea_level: f64, @@ -259,7 +259,7 @@ mod test { assert_eq!(weather.pressure, 1012); assert_eq!(weather.wind_speed, 5.4); assert_eq!(weather.wind_direction, 219); - assert_eq!(weather.uv_index, Some(2)); + assert_eq!(weather.uv_index, Some(2.)); assert_eq!(weather.icon, WeatherConditionIcon::LightShowers); assert_eq!(weather.description, "Light rain"); assert_eq!(weather.location_name, "ბათუმი, საქართველო"); // shortened name diff --git a/src/weather/weather_api.rs b/src/weather/weather_api.rs index cfc4ab5..78425b7 100644 --- a/src/weather/weather_api.rs +++ b/src/weather/weather_api.rs @@ -167,8 +167,8 @@ impl WeatherApiCurrent { (value * 10.0).round() / 10.0 // Round to 1 decimal place } - fn uv_index(&self) -> u8 { - self.uv.round() as u8 + fn uv_index(&self) -> f64 { + (self.uv * 10.).round() / 10. } fn dew_point(&self, units: Units) -> f64 { @@ -308,7 +308,7 @@ mod tests { assert_eq!(weather.pressure, 1011); assert_eq!(weather.wind_speed, 2.9); // 10.4 kph to m/s rounded to 1 decimal place assert_eq!(weather.wind_direction, 257); - assert_eq!(weather.uv_index, Some(5)); + assert_eq!(weather.uv_index, Some(5.3)); assert_eq!(weather.description, "Переменная облачность"); assert_eq!(weather.icon, WeatherConditionIcon::PartlyCloudy); } diff --git a/src/weather/weather_bit.rs b/src/weather/weather_bit.rs index 09fb781..ced81bf 100644 --- a/src/weather/weather_bit.rs +++ b/src/weather/weather_bit.rs @@ -144,8 +144,8 @@ struct WeatherData { } impl WeatherData { - fn uv_index(&self) -> u8 { - self.uv.round() as u8 + fn uv_index(&self) -> f64 { + (self.uv * 10.).round() / 10. } fn pressure(&self) -> u32 { @@ -279,7 +279,7 @@ mod tests { assert_eq!(weather.pressure, 1015); assert_eq!(weather.wind_speed, 3.5); assert_eq!(weather.wind_direction, 180); - assert_eq!(weather.uv_index, Some(5)); + assert_eq!(weather.uv_index, Some(5.0)); assert_eq!(weather.icon, WeatherConditionIcon::PartlyCloudy); assert_eq!(weather.description, "Partly cloudy"); assert_eq!(weather.location_name, "London"); diff --git a/src/weather/world_weather_online.rs b/src/weather/world_weather_online.rs index 7ee58ae..ef8dd90 100644 --- a/src/weather/world_weather_online.rs +++ b/src/weather/world_weather_online.rs @@ -212,8 +212,8 @@ impl WwoCurrentCondition { }) } - fn uv_index(&self) -> Result, RustormyError> { - let uv_index = self.uv_index.parse::().map_err(|e| { + fn uv_index(&self) -> Result, RustormyError> { + let uv_index = self.uv_index.parse::().map_err(|e| { RustormyError::ApiReturnedError(format!("Invalid UV index value: {e:?}")) })?; Ok(Some(uv_index)) From 587d78d13b24ec05aff10028c3ffa45b66b43b9f Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Tue, 31 Mar 2026 23:12:21 +0700 Subject: [PATCH 02/10] :bug: Replace unwrap/unreachable with error handling - yr.rs: use ok_or() for optional API response fields - api_keys.rs: exhaustive match instead of unreachable!() - app.rs: let-else for provider fallback, .ok() for flush - cli.rs: graceful error on cache clear failure - file.rs: safe fallback in location_name() --- src/app.rs | 10 +++++----- src/config/api_keys.rs | 6 +----- src/config/cli.rs | 5 ++++- src/config/file.rs | 7 ++++++- src/weather/yr.rs | 16 ++++++++++++++-- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/app.rs b/src/app.rs index 5c2a13d..2baff28 100644 --- a/src/app.rs +++ b/src/app.rs @@ -8,7 +8,7 @@ use std::time::Duration; fn clear_screen() { print!("\x1B[2J\x1B[1;1H\x1B[?25l"); - std::io::Write::flush(&mut std::io::stdout()).unwrap(); + std::io::Write::flush(&mut std::io::stdout()).ok(); } pub struct App { @@ -51,10 +51,10 @@ impl App { // TODO: Log this instead of printing to stderr eprintln!("Provider {p:?} failed: {error:?}"); } - self.provider = - GetWeatherProvider::new(self.config.provider().unwrap_or_else(|| { - self.formatter.display_error(&error); - })); + let Some(next) = self.config.provider() else { + self.formatter.display_error(&error); + }; + self.provider = GetWeatherProvider::new(next); continue; } _ => { diff --git a/src/config/api_keys.rs b/src/config/api_keys.rs index b83b9d3..2bd90a4 100644 --- a/src/config/api_keys.rs +++ b/src/config/api_keys.rs @@ -20,17 +20,13 @@ pub struct ApiKeys { impl ApiKeys { pub fn validate(&self, provider: Provider) -> Result<(), RustormyError> { - let no_api_key = matches!(provider, Provider::OpenMeteo | Provider::Yr); - if no_api_key { - return Ok(()); - } let has_api_key = match provider { + Provider::OpenMeteo | Provider::Yr => return Ok(()), Provider::OpenWeatherMap => !self.open_weather_map.is_empty(), Provider::WorldWeatherOnline => !self.world_weather_online.is_empty(), Provider::WeatherApi => !self.weather_api.is_empty(), Provider::WeatherBit => !self.weather_bit.is_empty(), Provider::TomorrowIo => !self.tomorrow_io.is_empty(), - _ => unreachable!(), }; if has_api_key { Ok(()) diff --git a/src/config/cli.rs b/src/config/cli.rs index f36e48d..331476e 100644 --- a/src/config/cli.rs +++ b/src/config/cli.rs @@ -93,7 +93,10 @@ impl Cli { let cli = Cli::parse(); if cli.clear_cache { - clear_cache().expect("Failed to clear cache"); + if let Err(e) = clear_cache() { + eprintln!("Failed to clear cache: {e}"); + std::process::exit(1); + } println!("Cache cleared successfully."); std::process::exit(0); } diff --git a/src/config/file.rs b/src/config/file.rs index d1bda92..d66b442 100644 --- a/src/config/file.rs +++ b/src/config/file.rs @@ -315,7 +315,12 @@ impl Config { pub fn location_name(&self) -> String { self.city.as_ref().map_or_else( - || format!("{}, {}", self.lat.unwrap(), self.lon.unwrap()), + || { + self.coordinates().map_or_else( + || "Unknown".to_string(), + |(lat, lon)| format!("{lat}, {lon}"), + ) + }, String::from, ) } diff --git a/src/weather/yr.rs b/src/weather/yr.rs index 518e4bf..14eb8ba 100644 --- a/src/weather/yr.rs +++ b/src/weather/yr.rs @@ -99,7 +99,14 @@ impl YrResponse { "No timeseries returned".to_string(), ))?; let details = ×eries.data.instant.details; - let next_hours = timeseries.data.next_1_hours.as_ref().unwrap(); + let next_hours = + timeseries + .data + .next_1_hours + .as_ref() + .ok_or(RustormyError::ApiReturnedError( + "No forecast data returned".to_string(), + ))?; let description = symbol_code_to_description(&next_hours.summary.symbol_code, config.language()); let icon = symbol_code_to_icon(&next_hours.summary.symbol_code); @@ -107,7 +114,12 @@ impl YrResponse { Ok(Weather { temperature: details.air_temperature, wind_speed: details.wind_speed, - wind_direction: details.wind_from_direction.unwrap().round() as u16, + wind_direction: details + .wind_from_direction + .ok_or(RustormyError::ApiReturnedError( + "No wind direction returned".to_string(), + ))? + .round() as u16, uv_index: get_uv_index(client, config, location)?, description, icon, From e64344ffb90d1ce8d28866a9766fffa94eb57b37 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Tue, 31 Mar 2026 23:14:28 +0700 Subject: [PATCH 03/10] :memo: Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d08cda2..826d91f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. See [Keep a Changelog](https://keepachangelog.com/) for details. This project adheres to [Semantic Versioning](https://semver.org/). +## [Unreleased] + +### Fixed + +- Replaced `.unwrap()` and `unreachable!()` in production code with proper error propagation for safer runtime behavior. + ## [0.4.2] - 2026-02-18 ### Added From f3682b7924610b7da511d5039ff398a80a13d300 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Tue, 31 Mar 2026 23:20:30 +0700 Subject: [PATCH 04/10] :recycle: Extract shared weather code and wind utils - Add owm_code_to_icon() and kph_to_ms() to tools.rs - Deduplicate icon mapping in open_weather_map and weather_bit - Deduplicate wind conversion in weather_api and world_weather_online --- src/weather/open_weather_map.rs | 21 +++++---------------- src/weather/tools.rs | 24 +++++++++++++++++++++++- src/weather/weather_api.rs | 13 +++++-------- src/weather/weather_bit.rs | 15 ++------------- src/weather/world_weather_online.rs | 15 ++++++--------- 5 files changed, 41 insertions(+), 47 deletions(-) diff --git a/src/weather/open_weather_map.rs b/src/weather/open_weather_map.rs index 30b4834..e544702 100644 --- a/src/weather/open_weather_map.rs +++ b/src/weather/open_weather_map.rs @@ -95,22 +95,11 @@ impl WeatherResponseData { } pub fn icon(&self) -> WeatherConditionIcon { - if let Some(weather) = self.weather.first() { - match weather.id { - 200..=232 => WeatherConditionIcon::Thunderstorm, - 300..=321 | 500 | 520 => WeatherConditionIcon::LightShowers, - 500..=531 => WeatherConditionIcon::HeavyShowers, - 600 | 612 | 615 | 620 => WeatherConditionIcon::LightSnow, - 601..=622 => WeatherConditionIcon::HeavySnow, - 701..=781 => WeatherConditionIcon::Fog, - 800 => WeatherConditionIcon::Clear, - 801 | 802 => WeatherConditionIcon::PartlyCloudy, - 803 | 804 => WeatherConditionIcon::Cloudy, - _ => WeatherConditionIcon::Unknown, - } - } else { - WeatherConditionIcon::Unknown - } + self.weather + .first() + .map_or(WeatherConditionIcon::Unknown, |w| { + tools::owm_code_to_icon(w.id) + }) } fn dew_point(&self, units: Units) -> f64 { diff --git a/src/weather/tools.rs b/src/weather/tools.rs index 0283d16..4226179 100644 --- a/src/weather/tools.rs +++ b/src/weather/tools.rs @@ -1,4 +1,4 @@ -use crate::models::Units; +use crate::models::{Units, WeatherConditionIcon}; /// Convert Celsius to Fahrenheit pub fn c_to_f(c: f64) -> f64 { @@ -40,3 +40,25 @@ pub fn apparent_temperature(t: f64, w: f64, h: f64) -> f64 { let at = t + 0.33 * e - 0.70 * w - 4.00; (at * 10.0).round() / 10.0 // Round to one decimal place } + +/// Convert km/h to m/s, rounded to 1 decimal place +pub fn kph_to_ms(kph: f64) -> f64 { + (kph / 3.6 * 10.0).round() / 10.0 +} + +/// Map OpenWeatherMap-style weather codes to icons. +/// Used by `OpenWeatherMap` and `WeatherBit` (same code scheme). +pub fn owm_code_to_icon(code: u32) -> WeatherConditionIcon { + match code { + 200..=232 => WeatherConditionIcon::Thunderstorm, + 300..=321 | 500 | 520 => WeatherConditionIcon::LightShowers, + 500..=531 => WeatherConditionIcon::HeavyShowers, + 600 | 612 | 615 | 620 => WeatherConditionIcon::LightSnow, + 601..=622 => WeatherConditionIcon::HeavySnow, + 701..=781 => WeatherConditionIcon::Fog, + 800 => WeatherConditionIcon::Clear, + 801 | 802 => WeatherConditionIcon::PartlyCloudy, + 803 | 804 => WeatherConditionIcon::Cloudy, + _ => WeatherConditionIcon::Unknown, + } +} diff --git a/src/weather/weather_api.rs b/src/weather/weather_api.rs index 78425b7..a29cfb4 100644 --- a/src/weather/weather_api.rs +++ b/src/weather/weather_api.rs @@ -1,7 +1,7 @@ use crate::config::Config; use crate::errors::RustormyError; use crate::models::{Units, Weather, WeatherConditionIcon}; -use crate::weather::GetWeather; +use crate::weather::{GetWeather, tools}; use reqwest::blocking::Client; const WEATHER_API_URL: &str = "https://api.weatherapi.com/v1/current.json"; @@ -158,13 +158,10 @@ impl WeatherApiCurrent { } fn wind_speed(&self, units: Units) -> f64 { - // TODO: move wind speed conversion to tools - let value = match units { - Units::Metric => self.wind_kph / 3.6, // Convert kph to m/s - Units::Imperial => self.wind_mph, - }; - - (value * 10.0).round() / 10.0 // Round to 1 decimal place + match units { + Units::Metric => tools::kph_to_ms(self.wind_kph), + Units::Imperial => (self.wind_mph * 10.0).round() / 10.0, + } } fn uv_index(&self) -> f64 { diff --git a/src/weather/weather_bit.rs b/src/weather/weather_bit.rs index ced81bf..687f015 100644 --- a/src/weather/weather_bit.rs +++ b/src/weather/weather_bit.rs @@ -1,7 +1,7 @@ use crate::config::Config; use crate::errors::RustormyError; use crate::models::{Location, Units, Weather, WeatherConditionIcon}; -use crate::weather::{GetWeather, LookUpCity}; +use crate::weather::{GetWeather, LookUpCity, tools}; use reqwest::blocking::Client; const GEOCODING_API_URL: &str = "https://api.weatherbit.io/v2.0/geocode"; @@ -179,18 +179,7 @@ struct WeatherDescription { impl WeatherDescription { fn icon(&self) -> WeatherConditionIcon { - match self.code { - 200..=232 => WeatherConditionIcon::Thunderstorm, - 300..=321 | 500 | 520 => WeatherConditionIcon::LightShowers, - 500..=531 => WeatherConditionIcon::HeavyShowers, - 600 | 612 | 615 | 620 => WeatherConditionIcon::LightSnow, - 601..=622 => WeatherConditionIcon::HeavySnow, - 701..=781 => WeatherConditionIcon::Fog, - 800 => WeatherConditionIcon::Clear, - 801 | 802 => WeatherConditionIcon::PartlyCloudy, - 803 | 804 => WeatherConditionIcon::Cloudy, - _ => WeatherConditionIcon::Unknown, - } + tools::owm_code_to_icon(self.code) } } diff --git a/src/weather/world_weather_online.rs b/src/weather/world_weather_online.rs index ef8dd90..727b9cc 100644 --- a/src/weather/world_weather_online.rs +++ b/src/weather/world_weather_online.rs @@ -162,18 +162,15 @@ impl WwoCurrentCondition { Units::Imperial => &self.windspeed_miles, }; - let mut value = value.parse::().map_err(|e| { + let value = value.parse::().map_err(|e| { RustormyError::ApiReturnedError(format!("Invalid wind speed value: {e:?}")) })?; - // TODO: move wind speed conversion to tools - if units == Units::Metric { - // Convert km/h to m/s for Metric - value /= 3.6; - } - value = (value * 10.0).round() / 10.0; // Round to 1 decimal place - - Ok(value) + Ok(if units == Units::Metric { + tools::kph_to_ms(value) + } else { + (value * 10.0).round() / 10.0 + }) } fn humidity(&self) -> Result { From 0a2fe2520cbce78e2558e78b31a2934e930ee082 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Wed, 1 Apr 2026 03:32:28 +0700 Subject: [PATCH 05/10] :white_check_mark: Add Cargo.lock --- .gitignore | 1 - CHANGELOG.md | 2 +- Cargo.lock | 2094 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2095 insertions(+), 2 deletions(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index facb142..b4737cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Rust stuff /target/ -/Cargo.lock # IDEA stuff /.idea diff --git a/CHANGELOG.md b/CHANGELOG.md index 826d91f..73c116b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed -- Replaced `.unwrap()` and `unreachable!()` in production code with proper error propagation for safer runtime behavior. +- Improve code quality and maintainability by refactoring and adding prehooks with correct clippy --all-targets check. ## [0.4.2] - 2026-02-18 diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..08d290a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2094 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "aws-lc-rs" +version = "1.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a054912289d18629dc78375ba2c3726a3afe3ff71b4edba9dedfca0e3446d1fc" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a25cf98105baa966497416dbd42565ce3a8cf8dbfd59803ec9ad46f3126399" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "capitalize" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b5271031022835ee8c7582fe67403bd6cb3d962095787af7921027234bab5bf" + +[[package]] +name = "cc" +version = "1.2.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "clap" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[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 = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "h2" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "797146bb2677299a1eb6b7b50a890f4c361b29ef967addf5b2fa45dae1bb6d7d" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" + +[[package]] +name = "libredox" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08" +dependencies = [ + "libc", +] + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "reqwest" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustls" +version = "0.23.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.103.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustormy" +version = "0.4.2" +dependencies = [ + "capitalize", + "clap", + "directories", + "enum_dispatch", + "reqwest", + "serde", + "serde_json", + "thiserror 2.0.18", + "toml", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +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.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994b95d9e7bae62b34bab0e2a4510b801fa466066a6a8b2b57361fa1eba068ee" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ca317ebc49f06bd748bfba29533eac9485569dc9bf80b849024b025e814fb9" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dc0882f7b5bb01ae8c5215a1230832694481c1a4be062fd410e12ea3da5b631" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19280959e2844181895ef62f065c63e0ca07ece4771b53d89bfdb967d97cbf05" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75973d3066e01d035dbedaad2864c398df42f8dd7b1ea057c35b8407c015b537" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91af5e4be765819e0bcfee7322c14374dc821e35e72fa663a830bbc7dc199eac" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9bf0406a78f02f336bf1e451799cca198e8acde4ffa278f0fb20487b150a633" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "749466a37ee189057f54748b200186b59a03417a117267baf3fd89cecc9fb837" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" From 9a3c5c48b9466bca0d5b903d59710d0adc51f298 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Wed, 1 Apr 2026 04:15:42 +0700 Subject: [PATCH 06/10] :bug: Fix Yr.no showing Unknown for most weather codes - Add YrWeatherCode enum covering all 41 codes from the legend - Strip _day/_night suffix once before matching - Add sleet and snow shower translations in all 4 languages - Add unit tests for code parsing, typo variants, and fallback --- CHANGELOG.md | 1 + Cargo.lock | 82 +---------- src/display/translations.rs | 42 ++++++ src/weather/yr.rs | 281 +++++++++++++++++++++++++++++++++--- 4 files changed, 305 insertions(+), 101 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73c116b..53ba57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed - Improve code quality and maintainability by refactoring and adding prehooks with correct clippy --all-targets check. +- Fixed Yr.no provider showing "Unknown" for many valid weather conditions (sleet, thunderstorms, showers, fair weather, etc.). ## [0.4.2] - 2026-02-18 diff --git a/Cargo.lock b/Cargo.lock index 08d290a..a7e0eb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -909,7 +909,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.52.0", ] [[package]] @@ -1084,7 +1084,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1706,7 +1706,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1762,15 +1762,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", -] - [[package]] name = "windows-sys" version = "0.61.2" @@ -1804,30 +1795,13 @@ dependencies = [ "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_gnullvm", "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.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -1840,12 +1814,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -1858,12 +1826,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -1876,24 +1838,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - [[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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -1906,12 +1856,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -1924,12 +1868,6 @@ 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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -1942,12 +1880,6 @@ 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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -1960,12 +1892,6 @@ 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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - [[package]] name = "winnow" version = "1.0.1" diff --git a/src/display/translations.rs b/src/display/translations.rs index 09f7eeb..8b2fae7 100644 --- a/src/display/translations.rs +++ b/src/display/translations.rs @@ -214,6 +214,42 @@ static TRANSLATIONS: LazyLock "Lluvia helada intensa", ["ko"] => "강한 얼음 비", }, + "Light sleet showers" => { + ["en"] => "Light sleet showers", + ["ru"] => "Небольшой мокрый снег с ливнем", + ["es"] => "Chubascos de aguanieve ligeros", + ["ko"] => "약한 진눈깨비 소나기", + }, + "Sleet showers" => { + ["en"] => "Sleet showers", + ["ru"] => "Мокрый снег с ливнем", + ["es"] => "Chubascos de aguanieve", + ["ko"] => "진눈깨비 소나기", + }, + "Heavy sleet showers" => { + ["en"] => "Heavy sleet showers", + ["ru"] => "Сильный мокрый снег с ливнем", + ["es"] => "Chubascos de aguanieve intensos", + ["ko"] => "강한 진눈깨비 소나기", + }, + "Light sleet" => { + ["en"] => "Light sleet", + ["ru"] => "Небольшой мокрый снег", + ["es"] => "Aguanieve ligera", + ["ko"] => "약한 진눈깨비", + }, + "Sleet" => { + ["en"] => "Sleet", + ["ru"] => "Мокрый снег", + ["es"] => "Aguanieve", + ["ko"] => "진눈깨비", + }, + "Heavy sleet" => { + ["en"] => "Heavy sleet", + ["ru"] => "Сильный мокрый снег", + ["es"] => "Aguanieve intensa", + ["ko"] => "강한 진눈깨비", + }, "Snow" => { ["en"] => "Snow", ["ru"] => "Снег", @@ -310,6 +346,12 @@ static TRANSLATIONS: LazyLock "Chubascos de nieve intensos", ["ko"] => "강한 눈 소나기", }, + "Snow showers" => { + ["en"] => "Snow showers", + ["ru"] => "Снежный ливень", + ["es"] => "Chubascos de nieve", + ["ko"] => "눈 소나기", + }, "Thunderstorm" => { ["en"] => "Thunderstorm", ["ru"] => "Гроза", diff --git a/src/weather/yr.rs b/src/weather/yr.rs index 14eb8ba..8928fcb 100644 --- a/src/weather/yr.rs +++ b/src/weather/yr.rs @@ -161,37 +161,211 @@ impl GetWeather for Yr { } } -fn symbol_code_to_description(code: &str, lang: Language) -> String { - match code { - "clearsky" | "clearsky_day" | "clearsky_night" => ll(lang, "Clear sky").to_string(), - "partlycloudy" | "partlycloudy_day" | "partlycloudy_night" => { - ll(lang, "Partly cloudy").to_string() +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum YrWeatherCode { + ClearSky, + Fair, + PartlyCloudy, + Cloudy, + LightRainShowers, + RainShowers, + HeavyRainShowers, + LightRainShowersAndThunder, + RainShowersAndThunder, + HeavyRainShowersAndThunder, + LightSleetShowers, + SleetShowers, + HeavySleetShowers, + LightSleetShowersAndThunder, + SleetShowersAndThunder, + HeavySleetShowersAndThunder, + LightSnowShowers, + SnowShowers, + HeavySnowShowers, + LightSnowShowersAndThunder, + SnowShowersAndThunder, + HeavySnowShowersAndThunder, + LightRain, + Rain, + HeavyRain, + LightRainAndThunder, + RainAndThunder, + HeavyRainAndThunder, + LightSleet, + Sleet, + HeavySleet, + LightSleetAndThunder, + SleetAndThunder, + HeavySleetAndThunder, + LightSnow, + Snow, + HeavySnow, + LightSnowAndThunder, + SnowAndThunder, + HeavySnowAndThunder, + Fog, +} + +impl YrWeatherCode { + fn description(self, lang: Language) -> String { + let key = match self { + Self::ClearSky => "Clear", + Self::Fair => "Mostly clear", + Self::PartlyCloudy => "Partly cloudy", + Self::Cloudy => "Cloudy", + Self::LightRainShowers => "Slight rain showers", + Self::RainShowers => "Moderate rain showers", + Self::HeavyRainShowers => "Violent rain showers", + Self::LightSleetShowers => "Light sleet showers", + Self::SleetShowers => "Sleet showers", + Self::HeavySleetShowers => "Heavy sleet showers", + Self::LightSnowShowers => "Slight snow showers", + Self::SnowShowers => "Snow showers", + Self::HeavySnowShowers => "Heavy snow showers", + Self::LightRain => "Light rain", + Self::Rain => "Rain", + Self::HeavyRain => "Heavy rain", + Self::LightSleet => "Light sleet", + Self::Sleet => "Sleet", + Self::HeavySleet => "Heavy sleet", + Self::LightSnow => "Light snow", + Self::Snow => "Snow", + Self::HeavySnow => "Heavy snow", + Self::Fog => "Fog", + Self::LightRainShowersAndThunder + | Self::RainShowersAndThunder + | Self::HeavyRainShowersAndThunder + | Self::LightSleetShowersAndThunder + | Self::SleetShowersAndThunder + | Self::HeavySleetShowersAndThunder + | Self::LightSnowShowersAndThunder + | Self::SnowShowersAndThunder + | Self::HeavySnowShowersAndThunder + | Self::LightRainAndThunder + | Self::RainAndThunder + | Self::HeavyRainAndThunder + | Self::LightSleetAndThunder + | Self::SleetAndThunder + | Self::HeavySleetAndThunder + | Self::LightSnowAndThunder + | Self::SnowAndThunder + | Self::HeavySnowAndThunder => "Thunderstorm", + }; + ll(lang, key).to_string() + } + + fn to_icon(self) -> WeatherConditionIcon { + match self { + Self::ClearSky => WeatherConditionIcon::Clear, + Self::Fair | Self::PartlyCloudy => WeatherConditionIcon::PartlyCloudy, + Self::Cloudy => WeatherConditionIcon::Cloudy, + Self::LightRainShowers | Self::RainShowers | Self::LightRain | Self::Rain => { + WeatherConditionIcon::LightShowers + } + Self::HeavyRainShowers + | Self::HeavyRain + | Self::HeavySleetShowers + | Self::HeavySleet => WeatherConditionIcon::HeavyShowers, + Self::LightSleetShowers + | Self::SleetShowers + | Self::LightSleet + | Self::Sleet + | Self::LightSnowShowers + | Self::SnowShowers + | Self::LightSnow + | Self::Snow => WeatherConditionIcon::LightSnow, + Self::HeavySnowShowers | Self::HeavySnow => WeatherConditionIcon::HeavySnow, + Self::Fog => WeatherConditionIcon::Fog, + Self::LightRainShowersAndThunder + | Self::RainShowersAndThunder + | Self::HeavyRainShowersAndThunder + | Self::LightSleetShowersAndThunder + | Self::SleetShowersAndThunder + | Self::HeavySleetShowersAndThunder + | Self::LightSnowShowersAndThunder + | Self::SnowShowersAndThunder + | Self::HeavySnowShowersAndThunder + | Self::LightRainAndThunder + | Self::RainAndThunder + | Self::HeavyRainAndThunder + | Self::LightSleetAndThunder + | Self::SleetAndThunder + | Self::HeavySleetAndThunder + | Self::LightSnowAndThunder + | Self::SnowAndThunder + | Self::HeavySnowAndThunder => WeatherConditionIcon::Thunderstorm, } - "cloudy" => ll(lang, "Cloudy").to_string(), - "rain" | "lightrain" | "lightrainshowers_day" => ll(lang, "Rain").to_string(), - "heavyrain" => ll(lang, "Heavy rain").to_string(), - "snow" | "lightsnow" | "heavysnow" => ll(lang, "Snow").to_string(), - "fog" => ll(lang, "Fog").to_string(), - _ => format!("{} ({code})", ll(lang, "Unknown")), } } -fn symbol_code_to_icon(code: &str) -> WeatherConditionIcon { - match code { - "clearsky" | "clearsky_day" | "clearsky_night" => WeatherConditionIcon::Clear, - "partlycloudy" | "partlycloudy_day" | "partlycloudy_night" => { - WeatherConditionIcon::PartlyCloudy +fn yr_weather_code(code: &str) -> Option { + let base = code + .strip_suffix("_day") + .or_else(|| code.strip_suffix("_night")) + .unwrap_or(code); + match base { + "clearsky" => Some(YrWeatherCode::ClearSky), + "fair" => Some(YrWeatherCode::Fair), + "partlycloudy" => Some(YrWeatherCode::PartlyCloudy), + "cloudy" => Some(YrWeatherCode::Cloudy), + "lightrainshowers" => Some(YrWeatherCode::LightRainShowers), + "rainshowers" => Some(YrWeatherCode::RainShowers), + "heavyrainshowers" => Some(YrWeatherCode::HeavyRainShowers), + "lightrainshowersandthunder" => Some(YrWeatherCode::LightRainShowersAndThunder), + "rainshowersandthunder" => Some(YrWeatherCode::RainShowersAndThunder), + "heavyrainshowersandthunder" => Some(YrWeatherCode::HeavyRainShowersAndThunder), + "lightsleetshowers" => Some(YrWeatherCode::LightSleetShowers), + "sleetshowers" => Some(YrWeatherCode::SleetShowers), + "heavysleetshowers" => Some(YrWeatherCode::HeavySleetShowers), + // "lightssleet..." is a typo in the legend CSV; match both spellings + "lightsleetshowersandthunder" | "lightssleetshowersandthunder" => { + Some(YrWeatherCode::LightSleetShowersAndThunder) + } + "sleetshowersandthunder" => Some(YrWeatherCode::SleetShowersAndThunder), + "heavysleetshowersandthunder" => Some(YrWeatherCode::HeavySleetShowersAndThunder), + "lightsnowshowers" => Some(YrWeatherCode::LightSnowShowers), + "snowshowers" => Some(YrWeatherCode::SnowShowers), + "heavysnowshowers" => Some(YrWeatherCode::HeavySnowShowers), + // "lightssnow..." is a typo in the legend CSV; match both spellings + "lightsnowshowersandthunder" | "lightssnowshowersandthunder" => { + Some(YrWeatherCode::LightSnowShowersAndThunder) } - "cloudy" => WeatherConditionIcon::Cloudy, - "rain" | "lightrain" | "lightrainshowers_day" => WeatherConditionIcon::LightShowers, - "heavyrain" => WeatherConditionIcon::HeavyShowers, - "snow" | "lightsnow" => WeatherConditionIcon::LightSnow, - "heavysnow" => WeatherConditionIcon::HeavySnow, - "fog" => WeatherConditionIcon::Fog, - _ => WeatherConditionIcon::Unknown, + "snowshowersandthunder" => Some(YrWeatherCode::SnowShowersAndThunder), + "heavysnowshowersandthunder" => Some(YrWeatherCode::HeavySnowShowersAndThunder), + "lightrain" => Some(YrWeatherCode::LightRain), + "rain" => Some(YrWeatherCode::Rain), + "heavyrain" => Some(YrWeatherCode::HeavyRain), + "lightrainandthunder" => Some(YrWeatherCode::LightRainAndThunder), + "rainandthunder" => Some(YrWeatherCode::RainAndThunder), + "heavyrainandthunder" => Some(YrWeatherCode::HeavyRainAndThunder), + "lightsleet" => Some(YrWeatherCode::LightSleet), + "sleet" => Some(YrWeatherCode::Sleet), + "heavysleet" => Some(YrWeatherCode::HeavySleet), + "lightsleetandthunder" => Some(YrWeatherCode::LightSleetAndThunder), + "sleetandthunder" => Some(YrWeatherCode::SleetAndThunder), + "heavysleetandthunder" => Some(YrWeatherCode::HeavySleetAndThunder), + "lightsnow" => Some(YrWeatherCode::LightSnow), + "snow" => Some(YrWeatherCode::Snow), + "heavysnow" => Some(YrWeatherCode::HeavySnow), + "lightsnowandthunder" => Some(YrWeatherCode::LightSnowAndThunder), + "snowandthunder" => Some(YrWeatherCode::SnowAndThunder), + "heavysnowandthunder" => Some(YrWeatherCode::HeavySnowAndThunder), + "fog" => Some(YrWeatherCode::Fog), + _ => None, } } +fn symbol_code_to_description(code: &str, lang: Language) -> String { + yr_weather_code(code).map_or_else( + || format!("{} ({code})", ll(lang, "Unknown")), + |c| c.description(lang), + ) +} + +fn symbol_code_to_icon(code: &str) -> WeatherConditionIcon { + yr_weather_code(code).map_or(WeatherConditionIcon::Unknown, YrWeatherCode::to_icon) +} + fn get_location(client: &Client, config: &Config) -> Result { match (config.coordinates(), config.city()) { (Some((lat, lon)), _) => Ok(Location { @@ -210,6 +384,67 @@ mod test { const TEST_API_RESPONSE: &str = include_str!("../../tests/data/yr.json"); + #[test] + fn test_yr_weather_code_known() { + assert_eq!(yr_weather_code("clearsky"), Some(YrWeatherCode::ClearSky)); + assert_eq!( + yr_weather_code("clearsky_day"), + Some(YrWeatherCode::ClearSky) + ); + assert_eq!( + yr_weather_code("clearsky_night"), + Some(YrWeatherCode::ClearSky) + ); + assert_eq!(yr_weather_code("fair"), Some(YrWeatherCode::Fair)); + assert_eq!(yr_weather_code("fair_day"), Some(YrWeatherCode::Fair)); + assert_eq!(yr_weather_code("fair_night"), Some(YrWeatherCode::Fair)); + assert_eq!(yr_weather_code("fog"), Some(YrWeatherCode::Fog)); + assert_eq!(yr_weather_code("heavyrain"), Some(YrWeatherCode::HeavyRain)); + assert_eq!( + yr_weather_code("snowandthunder"), + Some(YrWeatherCode::SnowAndThunder) + ); + } + + #[test] + fn test_yr_weather_code_unknown() { + assert_eq!(yr_weather_code("notacode"), None); + assert_eq!(yr_weather_code(""), None); + } + + #[test] + fn test_yr_weather_code_csv_typos() { + assert_eq!( + yr_weather_code("lightssleetshowersandthunder"), + Some(YrWeatherCode::LightSleetShowersAndThunder) + ); + assert_eq!( + yr_weather_code("lightssnowshowersandthunder"), + Some(YrWeatherCode::LightSnowShowersAndThunder) + ); + } + + #[test] + fn test_fair_night_description_and_icon() { + assert_eq!( + symbol_code_to_description("fair_night", Language::English), + "Mostly clear" + ); + assert_eq!( + symbol_code_to_icon("fair_night"), + WeatherConditionIcon::PartlyCloudy + ); + } + + #[test] + fn test_unknown_code_fallback() { + assert_eq!( + symbol_code_to_description("xyzzy", Language::English), + "Unknown (xyzzy)" + ); + assert_eq!(symbol_code_to_icon("xyzzy"), WeatherConditionIcon::Unknown); + } + #[test] #[allow(clippy::float_cmp)] fn test_parse_yr_response() { From fba5dda1c46f76b919c47731bba22518eb0c4968 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Wed, 1 Apr 2026 05:18:17 +0700 Subject: [PATCH 07/10] :recycle: Refactor config CLI merging and file loading - Deduplicate Config::new() with inline #[cfg] on differing let binding - Replace boolean flag boilerplate in merge_cli with |= / &= operators - Add text-mode mutual exclusion: --compact/--one-line/--text-mode conflict returns error - Extract pure parse_config() returning (Config, bool); migration write now explicit in load_from_file() - Surface modern-format parse error when both config parsers fail - Rename provider() to take_next_provider(); use drain(..1) instead of remove(0) - Change private path method signatures from &PathBuf to &Path - Add 7 tests for text-mode conflict/valid combinations --- src/app.rs | 4 +- src/config/file.rs | 238 ++++++++++++++++++++++++++++++------------- src/config/legacy.rs | 15 ++- 3 files changed, 181 insertions(+), 76 deletions(-) diff --git a/src/app.rs b/src/app.rs index 2baff28..ef97ec6 100644 --- a/src/app.rs +++ b/src/app.rs @@ -25,7 +25,7 @@ impl App { .user_agent(concat!("rustormy/", env!("CARGO_PKG_VERSION"))) .timeout(Duration::from_secs(config.connect_timeout())) .build()?; - let provider = GetWeatherProvider::new(config.provider().unwrap_or_default()); + let provider = GetWeatherProvider::new(config.take_next_provider().unwrap_or_default()); let formatter = WeatherFormatter::new(&config); Ok(Self { client, @@ -51,7 +51,7 @@ impl App { // TODO: Log this instead of printing to stderr eprintln!("Provider {p:?} failed: {error:?}"); } - let Some(next) = self.config.provider() else { + let Some(next) = self.config.take_next_provider() else { self.formatter.display_error(&error); }; self.provider = GetWeatherProvider::new(next); diff --git a/src/config/file.rs b/src/config/file.rs index d66b442..05fa56a 100644 --- a/src/config/file.rs +++ b/src/config/file.rs @@ -6,6 +6,8 @@ use crate::models::{ColorTheme, Language, OutputFormat, Provider, TextMode, Unit use directories::ProjectDirs; use serde::{Deserialize, Serialize}; use std::fs; +use std::path::Path; +#[cfg(not(test))] use std::path::PathBuf; const CONFIG_FILE_HEADER: &str = "# Rustormy Configuration File @@ -113,36 +115,43 @@ impl Default for Config { } impl Config { - #[cfg(not(test))] - pub fn new(cli: Cli) -> Result { - // Try to load config from file first - let file_path = Self::get_config_path()?; - let mut config = Self::load_from_file(&file_path)?.unwrap_or_default(); - - // Merge CLI arguments on top of file config - config.merge_cli(cli); - config.validate()?; - Ok(config) - } - - #[cfg(test)] pub fn new(cli: Cli) -> Result { + // test builds skip file I/O and use defaults + #[cfg(not(test))] + let mut config = { + let file_path = Self::get_config_path()?; + Self::load_from_file(&file_path)?.unwrap_or_default() + }; + #[cfg(test)] let mut config = Self::default(); - config.merge_cli(cli); + config.merge_cli(cli)?; config.validate()?; Ok(config) } - fn load_from_file(config_path: &PathBuf) -> Result, RustormyError> { + fn load_from_file(config_path: &Path) -> Result, RustormyError> { if !config_path.exists() { let default_config = Self::create_default_config_file(config_path)?; return Ok(Some(default_config)); } - let config = Self::read_and_parse_config_file(config_path)?; + let content = fs::read_to_string(config_path)?; + let (config, migrated) = Self::parse_config(&content)?; + if migrated { + config.write_to_file(config_path)?; + } Ok(Some(config)) } + fn parse_config(content: &str) -> Result<(Self, bool), RustormyError> { + match toml::from_str::(content) { + Ok(config) => Ok((config, false)), + Err(modern_err) => toml::from_str::(content) + .map(|legacy| (Config::from(legacy), true)) + .map_err(|_| RustormyError::ConfigParseError(modern_err)), + } + } + #[cfg(not(test))] fn get_config_path() -> Result { let proj_dirs = ProjectDirs::from("", "", "rustormy") @@ -154,13 +163,13 @@ impl Config { Ok(config_path) } - fn create_default_config_file(config_path: &PathBuf) -> Result { + fn create_default_config_file(config_path: &Path) -> Result { let default_config = Self::default(); default_config.write_to_file(config_path)?; Ok(default_config) } - fn write_to_file(&self, config_path: &PathBuf) -> Result<(), RustormyError> { + fn write_to_file(&self, config_path: &Path) -> Result<(), RustormyError> { // Create parent directories if they don't exist if let Some(parent) = config_path.parent() { fs::create_dir_all(parent)?; @@ -173,24 +182,13 @@ impl Config { Ok(()) } - fn read_and_parse_config_file(config_path: &PathBuf) -> Result { - let content = fs::read_to_string(config_path)?; - let config: Self = toml::from_str(&content).or_else(|_| { - let legacy_config: LegacyConfig = toml::from_str(&content)?; - let config = Config::from(legacy_config); - config.write_to_file(config_path)?; - Ok::(config) - })?; - Ok(config) - } - #[cfg(test)] - pub fn merge_cli_test(mut self, cli: Cli) -> Self { - self.merge_cli(cli); - self + pub fn merge_cli_test(mut self, cli: Cli) -> Result { + self.merge_cli(cli)?; + Ok(self) } - fn merge_cli(&mut self, cli: Cli) { + fn merge_cli(&mut self, cli: Cli) -> Result<(), RustormyError> { if let Some(city) = cli.city { self.city = Some(city); } @@ -216,37 +214,34 @@ impl Config { self.live_mode_interval = live_mode_interval; } - // Boolean flags are set directly if the flag is present - if cli.show_city_name { - self.format.show_city_name = true; - } - if cli.use_colors { - self.format.use_colors = true; - } - if cli.use_degrees_for_wind { - self.format.wind_in_degrees = true; - } - if cli.compact_mode { - self.format.text_mode = TextMode::Compact; - } - if cli.one_line_mode { - self.format.text_mode = TextMode::OneLine; - } - if let Some(text_mode) = cli.text_mode { - self.format.text_mode = text_mode; - } - if cli.align_right { - self.format.align_right = true; - } - if cli.live_mode { - self.live_mode = true; - } - if cli.no_cache { - self.use_geocoding_cache = false; - } + self.format.show_city_name |= cli.show_city_name; + self.format.use_colors |= cli.use_colors; + self.format.wind_in_degrees |= cli.use_degrees_for_wind; + self.format.align_right |= cli.align_right; + self.live_mode |= cli.live_mode; + self.use_geocoding_cache &= !cli.no_cache; if cli.verbose > 0 { self.verbose = cli.verbose; } + + let text_mode_count = [cli.compact_mode, cli.one_line_mode, cli.text_mode.is_some()] + .iter() + .filter(|&&f| f) + .count(); + if text_mode_count > 1 { + return Err(RustormyError::InvalidConfiguration( + "Only one of --compact, --one-line, or --text-mode may be specified at a time", + )); + } + if let Some(mode) = cli + .text_mode + .or(cli.compact_mode.then_some(TextMode::Compact)) + .or(cli.one_line_mode.then_some(TextMode::OneLine)) + { + self.format.text_mode = mode; + } + + Ok(()) } pub fn validate(&self) -> Result<(), RustormyError> { @@ -289,13 +284,9 @@ impl Config { &self.providers } - /// Pop the first provider from the list to try - pub fn provider(&mut self) -> Option { - if self.providers.is_empty() { - None - } else { - Some(self.providers.remove(0)) - } + /// Take the next provider from the front of the list to try + pub fn take_next_provider(&mut self) -> Option { + self.providers.drain(..1).next() } pub fn api_keys(&self) -> &ApiKeys { @@ -825,7 +816,7 @@ mod tests { verbose: 3, clear_cache: false, }; - config.merge_cli(cli); + config.merge_cli(cli).unwrap(); assert_eq!(config.city(), Some("CLI City")); assert_eq!(config.coordinates(), Some((30.0, 40.0))); assert_eq!(config.providers, vec![Provider::OpenWeatherMap]); @@ -842,4 +833,113 @@ mod tests { assert!(!config.use_geocoding_cache); assert_eq!(config.verbose, 3); } + + fn base_cli() -> Cli { + Cli { + city: Some("TestCity".to_string()), + lat: None, + lon: None, + provider: None, + units: None, + output_format: None, + language: None, + show_city_name: false, + use_colors: false, + use_degrees_for_wind: false, + compact_mode: false, + one_line_mode: false, + text_mode: None, + align_right: false, + live_mode: false, + live_mode_interval: None, + no_cache: false, + verbose: 0, + clear_cache: false, + } + } + + #[test] + fn test_text_mode_compact_only() { + let mut config = Config::default(); + config + .merge_cli(Cli { + compact_mode: true, + ..base_cli() + }) + .unwrap(); + assert_eq!(config.format.text_mode, TextMode::Compact); + } + + #[test] + fn test_text_mode_one_line_only() { + let mut config = Config::default(); + config + .merge_cli(Cli { + one_line_mode: true, + ..base_cli() + }) + .unwrap(); + assert_eq!(config.format.text_mode, TextMode::OneLine); + } + + #[test] + fn test_text_mode_flag_only() { + let mut config = Config::default(); + config + .merge_cli(Cli { + text_mode: Some(TextMode::Full), + ..base_cli() + }) + .unwrap(); + assert_eq!(config.format.text_mode, TextMode::Full); + } + + #[test] + fn test_text_mode_compact_and_one_line_conflict() { + let mut config = Config::default(); + let result = config.merge_cli(Cli { + compact_mode: true, + one_line_mode: true, + ..base_cli() + }); + assert!( + matches!(result, Err(RustormyError::InvalidConfiguration(_))), + "Expected conflict error, got {result:?}", + ); + } + + #[test] + fn test_text_mode_compact_and_flag_conflict() { + let mut config = Config::default(); + let result = config.merge_cli(Cli { + compact_mode: true, + text_mode: Some(TextMode::OneLine), + ..base_cli() + }); + assert!( + matches!(result, Err(RustormyError::InvalidConfiguration(_))), + "Expected conflict error, got {result:?}", + ); + } + + #[test] + fn test_text_mode_one_line_and_flag_conflict() { + let mut config = Config::default(); + let result = config.merge_cli(Cli { + one_line_mode: true, + text_mode: Some(TextMode::Compact), + ..base_cli() + }); + assert!( + matches!(result, Err(RustormyError::InvalidConfiguration(_))), + "Expected conflict error, got {result:?}", + ); + } + + #[test] + fn test_text_mode_none_unchanged() { + let mut config = Config::default(); + config.merge_cli(base_cli()).unwrap(); + assert_eq!(config.format.text_mode, TextMode::default()); + } } diff --git a/src/config/legacy.rs b/src/config/legacy.rs index 5460142..053f3d3 100644 --- a/src/config/legacy.rs +++ b/src/config/legacy.rs @@ -296,7 +296,8 @@ mod tests { "#; let legacy_config: LegacyConfig = toml::from_str(EXAMPLE).unwrap(); let config = Config::from(legacy_config) - .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])); + .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])) + .unwrap(); assert_eq!(config.city(), Some("TestCity")); assert_eq!(config.providers(), &vec![Provider::OpenMeteo]); assert_eq!(config.format().units, Units::Metric); @@ -324,7 +325,8 @@ mod tests { "#; let legacy_config: LegacyConfig = toml::from_str(EXAMPLE).unwrap(); let config = Config::from(legacy_config) - .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])); + .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])) + .unwrap(); assert_eq!(config.city(), Some("TestCity")); assert_eq!(config.providers(), &vec![Provider::OpenWeatherMap]); assert_eq!(config.api_keys().open_weather_map, "test_key"); @@ -358,7 +360,8 @@ mod tests { "#; let legacy_config: LegacyConfig = toml::from_str(EXAMPLE).unwrap(); let config = Config::from(legacy_config) - .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])); + .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])) + .unwrap(); assert_eq!(config.city(), Some("TestCity")); assert_eq!(config.providers(), &vec![Provider::OpenWeatherMap]); assert_eq!(config.api_keys().open_weather_map, "test_key"); @@ -452,7 +455,8 @@ mod tests { "#; let legacy_config: LegacyConfig = toml::from_str(EXAMPLE).unwrap(); let config = Config::from(legacy_config) - .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])); + .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])) + .unwrap(); assert_eq!(config.city(), Some("TestCity")); assert_eq!( config.providers(), @@ -573,7 +577,8 @@ mod tests { "#; let legacy_config: LegacyConfig = toml::from_str(EXAMPLE).unwrap(); let config = Config::from(legacy_config) - .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])); + .merge_cli_test(Cli::parse_from(["rustormy", "-c", "TestCity"])) + .unwrap(); assert_eq!(config.city(), Some("TestCity")); assert_eq!( config.providers(), From c988bacdcdcb85462cdbe2d29c9d677aa9a2cd4e Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Wed, 1 Apr 2026 06:40:49 +0700 Subject: [PATCH 08/10] :recycle: Refactor formatter wind and unit helpers - Extract `unit_strings()` to deduplicate unit setup in `format_text` and `format_one_line` - Extract `format_wind_value()` to eliminate duplicated wind formatting logic - Add `Language::label_width()` and use it in `label()` - Fix duplicate test assertions and wrong-index error message in formatter tests --- src/display/formatter.rs | 81 ++++++++++++++++------------------------ src/models.rs | 7 ++++ 2 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/display/formatter.rs b/src/display/formatter.rs index b5ca745..ad0695e 100644 --- a/src/display/formatter.rs +++ b/src/display/formatter.rs @@ -32,11 +32,7 @@ fn make_line( fn label(text: &'static str, config: &FormatterConfig) -> String { let lang = config.language; - let width = if config.language == Language::Korean { - 4 - } else { - 12 - }; + let width = lang.label_width(); let translated = ll(lang, text).to_string() + ":"; let padded = if config.align_right { format!("{translated:>width$}") @@ -56,6 +52,21 @@ const fn wind_deg_to_symbol(deg: u16) -> &'static str { symbols[index] } +fn unit_strings(units: Units, lang: Language) -> (&'static str, &'static str, &'static str) { + match units { + Units::Metric => ("°C", ll(lang, "m/s"), ll(lang, "mm")), + Units::Imperial => ("°F", ll(lang, "mph"), ll(lang, "inch")), + } +} + +fn format_wind_value(speed: f64, direction: u16, unit: &str, in_degrees: bool) -> String { + if in_degrees { + format!("{speed:.1} {unit} {direction}°") + } else { + format!("{speed:.1} {unit} {}", wind_deg_to_symbol(direction)) + } +} + impl WeatherFormatter { pub fn new(config: &Config) -> Self { Self { @@ -93,27 +104,18 @@ impl WeatherFormatter { fn format_one_line(&self, weather: Weather) -> String { let color_theme = &self.config.color_theme; - let (temp_unit, wind_unit) = match self.config.units { - Units::Metric => ("°C", ll(self.config.language, "m/s")), - Units::Imperial => ("°F", ll(self.config.language, "mph")), - }; + let (temp_unit, wind_unit, _) = unit_strings(self.config.units, self.config.language); let emoji = weather.icon.emoji(); let mut temperature = format!("{:.1}{}", weather.temperature, temp_unit); if self.config.use_colors { temperature = colored_text(temperature, color_theme.temperature); } - let wind = if self.config.wind_in_degrees { - format!( - "{:.1} {wind_unit} {}°", - weather.wind_speed, weather.wind_direction - ) - } else { - format!( - "{:.1} {wind_unit} {}", - weather.wind_speed, - wind_deg_to_symbol(weather.wind_direction) - ) - }; + let wind = format_wind_value( + weather.wind_speed, + weather.wind_direction, + wind_unit, + self.config.wind_in_degrees, + ); let wind = if self.config.use_colors { colored_text(wind, color_theme.wind) } else { @@ -140,10 +142,7 @@ impl WeatherFormatter { self.config.show_city_name, self.config.language, ); - let (temp_unit, wind_unit, precip_unit) = match self.config.units { - Units::Metric => ("°C", ll(lang, "m/s"), ll(lang, "mm")), - Units::Imperial => ("°F", ll(lang, "mph"), ll(lang, "inch")), - }; + let (temp_unit, wind_unit, precip_unit) = unit_strings(self.config.units, lang); let icon = if colors { weather.icon.colored_icon() } else { @@ -193,18 +192,12 @@ impl WeatherFormatter { output.push(make_line( icon[3], "Wind", - if self.config.wind_in_degrees { - format!( - "{:.1} {wind_unit} {}°", - weather.wind_speed, weather.wind_direction - ) - } else { - format!( - "{:.1} {wind_unit} {}", - weather.wind_speed, - wind_deg_to_symbol(weather.wind_direction) - ) - }, + format_wind_value( + weather.wind_speed, + weather.wind_direction, + wind_unit, + self.config.wind_in_degrees, + ), color_theme.wind, &self.config, )); @@ -336,11 +329,6 @@ mod tests { "Expected '0.5 mm' in line 4, got '{}'", lines[4] ); - assert!( - lines[4].contains("0.5 mm"), - "Expected '0.5 mm' in line 4, got '{}'", - lines[4] - ); assert!( lines[5].contains("Pressure"), "Expected 'Pressure' in line 5, got '{}'", @@ -440,11 +428,6 @@ mod tests { "Expected '0.5 mm' in line 3, got '{}'", lines[3] ); - assert!( - lines[3].contains("0.5 mm"), - "Expected '0.5 mm' in line 3, got '{}'", - lines[3] - ); assert!( !lines[4].contains("Pressure"), "Expected no 'Pressure' label in compact mode, got '{}'", @@ -472,8 +455,8 @@ mod tests { ); assert!( lines[5].contains("14.3°C"), - "Expected '14.3°C' in line 6, got '{}'", - lines[6] + "Expected '14.3°C' in line 5, got '{}'", + lines[5] ); } diff --git a/src/models.rs b/src/models.rs index 70c6065..3d77087 100644 --- a/src/models.rs +++ b/src/models.rs @@ -133,6 +133,13 @@ impl Language { Self::Korean => "ko", } } + + pub fn label_width(self) -> usize { + match self { + Self::Korean => 4, + _ => 12, + } + } } impl Display for Language { From b4d1b44d6b64f9b823d263b08542aabe17759182 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Wed, 1 Apr 2026 07:04:41 +0700 Subject: [PATCH 09/10] :recycle: Replace flat error structs with ApiResponse enum --- src/weather/open_meteo.rs | 58 ++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/src/weather/open_meteo.rs b/src/weather/open_meteo.rs index 10d3dba..7d3b2cb 100644 --- a/src/weather/open_meteo.rs +++ b/src/weather/open_meteo.rs @@ -13,23 +13,33 @@ const WEATHER_API_URL: &str = "https://api.open-meteo.com/v1/forecast"; #[derive(Debug, Default)] pub struct OpenMeteo {} -// TODO: refactor to enum Ok/Err #[derive(Debug, Deserialize)] -struct OpenMeteoResponse { - current: CurrentWeather, - error: Option, - reason: Option, +#[serde(untagged)] +enum ApiResponse { + Ok(T), + Err { + _error: bool, + reason: Option, + }, } -impl OpenMeteoResponse { - pub fn is_error(&self) -> bool { - self.error.unwrap_or(false) +impl ApiResponse { + fn into_result(self) -> Result { + match self { + Self::Ok(data) => Ok(data), + Self::Err { reason, .. } => Err(RustormyError::ApiReturnedError( + reason.unwrap_or_else(|| "Unknown error".to_string()), + )), + } } +} - pub fn into_error_reason(self) -> String { - self.reason.unwrap_or_else(|| "Unknown error".to_string()) - } +#[derive(Debug, Deserialize)] +struct OpenMeteoResponse { + current: CurrentWeather, +} +impl OpenMeteoResponse { pub fn into_weather( self, client: &Client, @@ -149,19 +159,9 @@ impl<'a> GeocodingRequest<'a> { #[derive(Debug, Deserialize)] struct GeocodingResponse { results: Option>, - error: Option, - reason: Option, } impl GeocodingResponse { - pub fn is_error(&self) -> bool { - self.error.unwrap_or(false) - } - - pub fn into_error_reason(self) -> String { - self.reason.unwrap_or_else(|| "Unknown error".to_string()) - } - pub fn into_location(self) -> Option { self.results .and_then(|mut results| results.pop()) @@ -221,11 +221,9 @@ impl LookUpCity for OpenMeteo { let request = GeocodingRequest::new(city, config.language()); let response = client.get(GEO_API_URL).query(&request).send()?; - let data: GeocodingResponse = response.json()?; - - if data.is_error() { - return Err(RustormyError::ApiReturnedError(data.into_error_reason())); - } + let data = response + .json::>()? + .into_result()?; let location = data .into_location() @@ -242,11 +240,9 @@ impl GetWeather for OpenMeteo { .get(WEATHER_API_URL) .query(&WeatherAPIRequest::new(&location, config)) .send()?; - let data: OpenMeteoResponse = response.json()?; - - if data.is_error() { - return Err(RustormyError::ApiReturnedError(data.into_error_reason())); - } + let data = response + .json::>()? + .into_result()?; data.into_weather(client, config, &location) } From 4cd97d56f73bbd56d482fbd84ac6b099a4354c17 Mon Sep 17 00:00:00 2001 From: Ilia Agafonov Date: Wed, 1 Apr 2026 07:24:08 +0700 Subject: [PATCH 10/10] :bug: Fix tests.rs cfg gate and tomorrow_io UV rounding - Restore #![cfg(test)] to keep test fixtures out of production builds - Fix tomorrow_io UV index rounding to 1 decimal place --- src/tests.rs | 1 + src/weather/tomorrow_io.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests.rs b/src/tests.rs index 0acd658..1251392 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,3 +1,4 @@ +#![cfg(test)] use crate::models::Location; use crate::weather::{LookUpCity, tools}; use crate::{ diff --git a/src/weather/tomorrow_io.rs b/src/weather/tomorrow_io.rs index 05489f3..81576c4 100644 --- a/src/weather/tomorrow_io.rs +++ b/src/weather/tomorrow_io.rs @@ -184,7 +184,7 @@ impl WeatherResponse { pressure, wind_speed: data.values.wind_speed, wind_direction: data.values.wind_direction, - uv_index: Some(data.values.uv_index), + uv_index: Some((data.values.uv_index * 10.0).round() / 10.0), icon: data.values.icon(), description: data.values.description(config.language()).to_string(), location_name: location.name(),