Struct google_maps::LatLng
source · pub struct LatLng {
pub lat: Decimal,
pub lng: Decimal,
}
Expand description
Latitude and longitude values must correspond to a valid location on the face of the earth. Latitudes can take any value between -90 and 90 while longitude values can take any value between -180 and 180. If you specify an invalid latitude or longitude value, your request will be rejected as a bad request.
Fields§
§lat: Decimal
Latitude. A value between -90.0° and 90.0°.
lng: Decimal
Longitude. A value between -180.0° and 180.0°.
Implementations§
source§impl LatLng
impl LatLng
sourcepub fn try_from_dec(
latitude: Decimal,
longitude: Decimal
) -> Result<LatLng, GoogleMapsError>
pub fn try_from_dec( latitude: Decimal, longitude: Decimal ) -> Result<LatLng, GoogleMapsError>
Takes individual latitude & longitude Decimal
coordinates and
converts them into a LatLng
structure. If either the latitude
(-90.0 to +90.0) or longitude (-180.0 to +180.0) are out of range, this
function will return an error.
source§impl LatLng
impl LatLng
sourcepub fn try_from_f32(
latitude: f32,
longitude: f32
) -> Result<LatLng, GoogleMapsError>
pub fn try_from_f32( latitude: f32, longitude: f32 ) -> Result<LatLng, GoogleMapsError>
Takes individual latitude & longitude f32
coordinates and
converts them into a LatLng
structure. If either the latitude
(-90.0 to +90.0) or longitude (-180.0 to +180.0) are out of range, this
function will return an error.
source§impl LatLng
impl LatLng
sourcepub fn try_from_f64(
latitude: f64,
longitude: f64
) -> Result<LatLng, GoogleMapsError>
pub fn try_from_f64( latitude: f64, longitude: f64 ) -> Result<LatLng, GoogleMapsError>
Takes individual latitude & longitude f64
coordinates and
converts them into a LatLng
structure. If either the latitude
(-90.0 to +90.0) or longitude (-180.0 to +180.0) are out of range, this
function will return an error.
source§impl LatLng
impl LatLng
sourcepub fn latitude(&self) -> &Decimal
pub fn latitude(&self) -> &Decimal
Returns the north-south latitudinal (or vertical) coordinate.
sourcepub fn longitude(&self) -> &Decimal
pub fn longitude(&self) -> &Decimal
Returns the east-west longitudinal (or horizontal) coordinate.
sourcepub fn coords(&self) -> (&Decimal, &Decimal)
pub fn coords(&self) -> (&Decimal, &Decimal)
Returns a tuple containing 1. the latitude (y) coordinate, and then 2. the longitude (x) coordinate, in that order.
sourcepub fn coordinates(&self) -> (&Decimal, &Decimal)
pub fn coordinates(&self) -> (&Decimal, &Decimal)
Returns a tuple containing 1. the latitude (y) coordinate, and then 2. the longitude (x) coordinate, in that order.
Trait Implementations§
source§impl<'de> Deserialize<'de> for LatLng
impl<'de> Deserialize<'de> for LatLng
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>,
source§impl Ord for LatLng
impl Ord for LatLng
source§impl PartialEq<LatLng> for LatLng
impl PartialEq<LatLng> for LatLng
source§impl PartialOrd<LatLng> for LatLng
impl PartialOrd<LatLng> for LatLng
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for LatLng
impl StructuralEq for LatLng
impl StructuralPartialEq for LatLng
Auto Trait Implementations§
impl RefUnwindSafe for LatLng
impl Send for LatLng
impl Sync for LatLng
impl Unpin for LatLng
impl UnwindSafe for LatLng
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.