Begin module src/free_api_v25/current/

- Add doc comments
- Add sub-module `coord`
- `clippy` fixes
This commit is contained in:
Candifloss 2025-10-10 00:11:25 +05:30
parent 47972b9573
commit c45bbaa0f1
4 changed files with 54 additions and 0 deletions

View File

@ -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 }
}
}

View File

@ -0,0 +1,20 @@
//! # Current Weather Data
//!
//! Data structures and utilities for parsing and working with responses
//! from the **`OpenWeatherMap` Current Weather API**.
//!
//! See: <https://openweathermap.org/current>
//!
//! ## 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;

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@