From c45bbaa0f1c95c0e1400a5ef30953ca4d69a856f Mon Sep 17 00:00:00 2001 From: Candifloss Date: Fri, 10 Oct 2025 00:11:25 +0530 Subject: [PATCH] Begin module `src/free_api_v25/current/` - Add doc comments - Add sub-module `coord` - `clippy` fixes --- src/free_api_v25/current/coord.rs | 32 +++++++++++++++++++++++++++++++ src/free_api_v25/current/mod.rs | 20 +++++++++++++++++++ src/free_api_v25/forecast/mod.rs | 1 + src/free_api_v25/query/mod.rs | 1 + 4 files changed, 54 insertions(+) create mode 100644 src/free_api_v25/current/coord.rs diff --git a/src/free_api_v25/current/coord.rs b/src/free_api_v25/current/coord.rs new file mode 100644 index 0000000..af0134a --- /dev/null +++ b/src/free_api_v25/current/coord.rs @@ -0,0 +1,32 @@ +use serde::{Deserialize, Serialize}; + +/// Geographic coordinates (longitude and latitude) +/// +/// # Example +/// ``` +/// use owm_api25::current::Coord; +/// +/// let coord = Coord { lon: -0.1257, lat: 51.5085 }; +/// assert_eq!(coord.lon, -0.1257); +/// assert_eq!(coord.lat, 51.5085); +/// ``` +#[derive(Debug, Clone, Deserialize, Serialize, Default, PartialEq)] +pub struct Coord { + pub lon: f64, + pub lat: f64, +} + +impl Coord { + /// Creates new coordinates from longitude and latitude + /// + /// # Example + /// ``` + /// use owm_api25::current::Coord; + /// + /// let london = Coord::new(-0.1257, 51.5085); + /// ``` + #[must_use] + pub fn new(lon: f64, lat: f64) -> Self { + Self { lon, lat } + } +} diff --git a/src/free_api_v25/current/mod.rs b/src/free_api_v25/current/mod.rs index e69de29..0595e57 100644 --- a/src/free_api_v25/current/mod.rs +++ b/src/free_api_v25/current/mod.rs @@ -0,0 +1,20 @@ +//! # Current Weather Data +//! +//! Data structures and utilities for parsing and working with responses +//! from the **`OpenWeatherMap` Current Weather API**. +//! +//! See: +//! +//! ## Features +//! +//! - Complete type-safe representation of all API response fields +//! - Optional fields for resilience against API changes +//! - Convenient accessor methods +//! - Chrono integration for date/time handling +//! - Comprehensive error handling +//! +//! ## See Also +//! - [`forecast`](crate::forecast) for multi-day weather data +//! - [`query`](crate::query) for building request URLs + +pub mod coord; diff --git a/src/free_api_v25/forecast/mod.rs b/src/free_api_v25/forecast/mod.rs index e69de29..8b13789 100644 --- a/src/free_api_v25/forecast/mod.rs +++ b/src/free_api_v25/forecast/mod.rs @@ -0,0 +1 @@ + diff --git a/src/free_api_v25/query/mod.rs b/src/free_api_v25/query/mod.rs index e69de29..8b13789 100644 --- a/src/free_api_v25/query/mod.rs +++ b/src/free_api_v25/query/mod.rs @@ -0,0 +1 @@ +