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°).
Trait Implementations§
Source§impl Angle for Longitude
impl Angle for Longitude
const MIN: Self
const MAX: Self
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.
fn as_float(&self) -> OrderedFloat<f64>
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 self.abs(), assuming overflow cannot occur. Read more
Source§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 more
Source§impl Formatter for Longitude
impl Formatter for Longitude
fn format<W: Write>(&self, f: &mut W, fmt: &FormatOptions) -> Result
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
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