#[non_exhaustive]pub enum CoordRefSystem {
Wgs84,
}Expand description
The reference system of the provided coordinates.
Currently only the WGS-84 coordinate reference system is supported.
It defines the latitude and longitude of the GeoUri to be in decimal degrees and the
altitude in meters.
For more details see the component description in RFC 5870.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Wgs84
The WGS-84 coordinate reference system.
Implementations§
Source§impl CoordRefSystem
impl CoordRefSystem
Sourcepub fn validate(&self, latitude: f64, longitude: f64) -> Result<(), Error>
pub fn validate(&self, latitude: f64, longitude: f64) -> Result<(), Error>
Validates geolocation coordinates against the selected coordinate reference system.
§Examples
let crs = CoordRefSystem::Wgs84;
assert_eq!(crs.validate(52.107, 5.134), Ok(()));
assert_eq!(
crs.validate(100.0, 5.134), // Latitude not in range `-90.0..=90.0`!
Err(Error::OutOfRangeLatitude)
);
assert_eq!(
crs.validate(51.107, -200.0), // Longitude not in range `-180.0..=180.0`!
Err(Error::OutOfRangeLongitude)
);§Errors
An error is returned if the latitude/longitude is out of range with respect to the coordinate reference system.
Trait Implementations§
Source§impl Clone for CoordRefSystem
impl Clone for CoordRefSystem
Source§fn clone(&self) -> CoordRefSystem
fn clone(&self) -> CoordRefSystem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CoordRefSystem
Source§impl Debug for CoordRefSystem
impl Debug for CoordRefSystem
Source§impl Default for CoordRefSystem
impl Default for CoordRefSystem
impl Eq for CoordRefSystem
Source§impl PartialEq for CoordRefSystem
impl PartialEq for CoordRefSystem
Source§fn eq(&self, other: &CoordRefSystem) -> bool
fn eq(&self, other: &CoordRefSystem) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CoordRefSystem
Auto Trait Implementations§
impl Freeze for CoordRefSystem
impl RefUnwindSafe for CoordRefSystem
impl Send for CoordRefSystem
impl Sync for CoordRefSystem
impl Unpin for CoordRefSystem
impl UnsafeUnpin for CoordRefSystem
impl UnwindSafe for CoordRefSystem
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