Candifloss c45bbaa0f1 Begin module src/free_api_v25/current/
- Add doc comments
- Add sub-module `coord`
- `clippy` fixes
2025-10-10 00:11:25 +05:30

33 lines
731 B
Rust

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