pub struct Longitude(/* private fields */);Expand description
A geographic longitude value, constrained to −180 ≤ degrees ≤ 180.
Positive values are east of the international reference meridian; negative values are west.
§Examples
use lat_long::{Angle, Longitude};
let lon = Longitude::new(-73, 56, 0.0).unwrap();
assert!(lon.is_western());Implementations§
Source§impl Longitude
impl Longitude
Sourcepub fn is_on_international_reference_meridian(&self) -> bool
pub fn is_on_international_reference_meridian(&self) -> bool
Returns true if this longitude is exactly on the IERS International Reference Meridian (IRM), or 0°.
Sourcepub fn is_western(&self) -> bool
pub fn is_western(&self) -> bool
Returns true if this longitude is in the western hemisphere (< 0°).
Sourcepub fn is_eastern(&self) -> bool
pub fn is_eastern(&self) -> bool
Returns true if this longitude is in the eastern hemisphere (> 0°).
Sourcepub fn utm_zone(&self) -> u8
pub fn utm_zone(&self) -> u8
Return the UTM longitude zone number (1–60) covering this longitude.
Zones are 6° wide and are numbered starting at the antimeridian (180° W = zone 1) and increasing eastward.
§Examples
use lat_long::{Angle, Longitude};
// Seattle ~ -122.3° falls in zone 10.
let lon = Longitude::try_from(-122.3).unwrap();
assert_eq!(lon.utm_zone(), 10);Trait Implementations§
Source§impl Angle for Longitude
impl Angle for Longitude
Source§fn new(degrees: i32, minutes: u32, seconds: f32) -> Result<Self, Error>
fn new(degrees: i32, minutes: u32, seconds: f32) -> Result<Self, Error>
Construct a new angle from degrees, minutes, and seconds. Read more
Source§fn as_float(&self) -> OrderedFloat<f64>
fn as_float(&self) -> OrderedFloat<f64>
Returns the underlying decimal-degree value as an
OrderedFloat<f64>. Read moreSource§fn to_radians(&self) -> f64
fn to_radians(&self) -> f64
Returns the angle converted from decimal degrees to radians. Read more
Source§fn from_radians(radians: f64) -> Result<Self, Error>where
Self: Sized,
fn from_radians(radians: f64) -> Result<Self, Error>where
Self: Sized,
Construct an angle from a value in radians. Read more
Source§fn is_nonzero_positive(&self) -> bool
fn is_nonzero_positive(&self) -> bool
Returns
true if the angle is positive and non-zero.Source§fn is_nonzero_negative(&self) -> bool
fn is_nonzero_negative(&self) -> bool
Returns
true if the angle is negative and non-zero.Source§fn degrees(&self) -> i32
fn degrees(&self) -> i32
The signed integer degrees component (carries the sign for negative angles).
Source§fn checked_abs(self) -> Option<Self>where
Self: Sized,
fn checked_abs(self) -> Option<Self>where
Self: Sized,
Checked absolute value. Computes
self.abs(), returning None if self == MIN.Source§fn overflowing_abs(self) -> (Self, bool)where
Self: Sized,
fn overflowing_abs(self) -> (Self, bool)where
Self: Sized,
Computes the absolute value of self. Read more
Source§fn saturating_abs(self) -> Selfwhere
Self: Sized,
fn saturating_abs(self) -> Selfwhere
Self: Sized,
Saturating absolute value. Computes
self.abs(), returning MAX
if self == MIN instead of overflowing.Source§fn strict_abs(self) -> Selfwhere
Self: Sized,
fn strict_abs(self) -> Selfwhere
Self: Sized,
Strict absolute value. Computes
self.abs(), panicking if self == MIN.Source§fn unchecked_abs(self) -> Selfwhere
Self: Sized,
fn unchecked_abs(self) -> Selfwhere
Self: Sized,
Unchecked absolute value. Computes s
elf.abs(), assuming overflow cannot occur. Read moreSource§fn wrapping_abs(self) -> Selfwhere
Self: Sized,
fn wrapping_abs(self) -> Selfwhere
Self: Sized,
Wrapping (modular) absolute value. Computes
self.abs(), wrapping around at
the boundary of the type. Read moreSource§impl<'de> Deserialize<'de> for Longitude
impl<'de> Deserialize<'de> for Longitude
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
Source§impl Formatter for Longitude
impl Formatter for Longitude
Source§fn to_formatted_string(&self, fmt: &FormatOptions) -> String
fn to_formatted_string(&self, fmt: &FormatOptions) -> String
Source§impl From<Longitude> for Coordinate
impl From<Longitude> for Coordinate
Source§impl Ord for Longitude
impl Ord for Longitude
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Longitude
impl PartialOrd for Longitude
impl Copy for Longitude
impl Eq for Longitude
impl StructuralPartialEq for Longitude
Auto Trait Implementations§
impl Freeze for Longitude
impl RefUnwindSafe for Longitude
impl Send for Longitude
impl Sync for Longitude
impl Unpin for Longitude
impl UnsafeUnpin for Longitude
impl UnwindSafe for Longitude
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