Begin module src/free_api_v25/current/
- Add doc comments - Add sub-module `coord` - `clippy` fixes
This commit is contained in:
parent
47972b9573
commit
c45bbaa0f1
32
src/free_api_v25/current/coord.rs
Normal file
32
src/free_api_v25/current/coord.rs
Normal 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 }
|
||||
}
|
||||
}
|
@ -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;
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
Loading…
x
Reference in New Issue
Block a user