pub struct Location(_, _);
Expand description
Location defines a point using its latitude and longitude.
Implementations
sourceimpl Location
impl Location
sourcepub fn new<T: Into<f64>>(lat: T, lon: T) -> Self
pub fn new<T: Into<f64>>(lat: T, lon: T) -> Self
Create a new Location with its degree values of latitude and longitude.
sourcepub const fn new_const(lat: f64, lon: f64) -> Self
pub const fn new_const(lat: f64, lon: f64) -> Self
Create a new const Location with its degree values of latitude and longitude.
sourcepub fn distance_to(&self, to: &Location) -> Result<Distance, String>
pub fn distance_to(&self, to: &Location) -> Result<Distance, String>
Find the distance from itself to another point. Internally uses Vincenty’s inverse formula. For better performance and lesser accuracy, consider haversine_distance_to. This method returns Err if the formula fails to converge within 100 iterations.
sourcepub fn haversine_distance_to(&self, to: &Location) -> Distance
pub fn haversine_distance_to(&self, to: &Location) -> Distance
Find the distance from itself to another point using Haversine formula. This is usually computationally less intensive than distance_to but is generally not as accurate.
Trait Implementations
impl Copy for Location
impl StructuralPartialEq for Location
Auto Trait Implementations
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more