dioxus_leaflet/types/
latlng.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, Default, PartialEq, Serialize, Deserialize)]
4pub struct LatLng {
5    pub lat: f64,
6    pub lng: f64,
7}
8
9impl LatLng {
10    pub const fn new(lat: f64, lng: f64) -> Self {
11        Self { lat, lng }
12    }
13}
14
15impl std::ops::Add for LatLng {
16    type Output = LatLng;
17    fn add(self, rhs: Self) -> Self::Output {
18        Self::new(self.lat + rhs.lat, self.lng + rhs.lng)
19    }
20}
21
22impl std::ops::AddAssign for LatLng {
23    fn add_assign(&mut self, rhs: Self) {
24        self.lat += rhs.lat;
25        self.lng += rhs.lng;
26    }
27}