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<Self, GoogleMapsError>
pub fn try_from_dec( latitude: Decimal, longitude: Decimal ) -> Result<Self, 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<Self, GoogleMapsError>
pub fn try_from_f32( latitude: f32, longitude: f32 ) -> Result<Self, 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<Self, GoogleMapsError>
pub fn try_from_f64( latitude: f64, longitude: f64 ) -> Result<Self, 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 const fn y(&self) -> &Decimal
pub const fn y(&self) -> &Decimal
Returns the north-south latitudinal (or vertical) coordinate.
sourcepub const fn lat(&self) -> &Decimal
pub const fn lat(&self) -> &Decimal
Returns the north-south latitudinal (or vertical) coordinate.
sourcepub const fn latitude(&self) -> &Decimal
pub const fn latitude(&self) -> &Decimal
Returns the north-south latitudinal (or vertical) coordinate.
sourcepub const fn x(&self) -> &Decimal
pub const fn x(&self) -> &Decimal
Returns the east-west longitudinal (or horizontal) coordinate.
sourcepub const fn lng(&self) -> &Decimal
pub const fn lng(&self) -> &Decimal
Returns the east-west longitudinal (or horizontal) coordinate.
sourcepub const fn lon(&self) -> &Decimal
pub const fn lon(&self) -> &Decimal
Returns the east-west longitudinal (or horizontal) coordinate.
sourcepub const fn long(&self) -> &Decimal
pub const fn long(&self) -> &Decimal
Returns the east-west longitudinal (or horizontal) coordinate.
sourcepub const fn longitude(&self) -> &Decimal
pub const fn longitude(&self) -> &Decimal
Returns the east-west longitudinal (or horizontal) coordinate.
sourcepub const fn coords(&self) -> (&Decimal, &Decimal)
pub const 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 const fn coordinates(&self) -> (&Decimal, &Decimal)
pub const 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 for LatLng
impl PartialEq for LatLng
source§impl PartialOrd for LatLng
impl PartialOrd 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 more