pub struct GpsData {
pub lat: f64,
pub lon: f64,
}Expand description
GPS location data (latitude and longitude).
Fields§
§lat: f64§lon: f64Implementations§
Source§impl GpsData
impl GpsData
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate GPS coordinates are within valid ranges.
Checks if latitude and longitude values are within valid geographic ranges. Helps catch data corruption or API issues early.
§Returns
Ok(()) if valid, Err(String) with descriptive error message
otherwise
§Valid Ranges
- Latitude: -90.0 to +90.0 degrees
- Longitude: -180.0 to +180.0 degrees
§Examples
use edgefirst_client::GpsData;
let gps = GpsData {
lat: 37.7749,
lon: -122.4194,
};
assert!(gps.validate().is_ok());
let bad_gps = GpsData {
lat: 100.0,
lon: 0.0,
};
assert!(bad_gps.validate().is_err());Trait Implementations§
Source§impl<'de> Deserialize<'de> for GpsData
impl<'de> Deserialize<'de> for GpsData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GpsData
impl RefUnwindSafe for GpsData
impl Send for GpsData
impl Sync for GpsData
impl Unpin for GpsData
impl UnwindSafe for GpsData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more