1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
7pub struct ParseGeoPoint {
8 #[serde(rename = "__type")]
9 type_field: String, pub latitude: f64,
11 pub longitude: f64,
12}
13
14impl ParseGeoPoint {
15 pub fn new(latitude: f64, longitude: f64) -> Self {
20 if !(-90.0..=90.0).contains(&latitude) {
21 panic!("Latitude must be between -90 and 90 degrees.");
22 }
23 if !(-180.0..=180.0).contains(&longitude) {
24 panic!("Longitude must be between -180 and 180 degrees.");
25 }
26 ParseGeoPoint {
27 type_field: "GeoPoint".to_string(),
28 latitude,
29 longitude,
30 }
31 }
32}