DMS

Struct DMS 

Source
pub struct DMS {
    pub degrees: u16,
    pub minutes: u8,
    pub seconds: f64,
    pub cardinal: Option<Cardinal>,
}
Expand description

Angle expressed as D°M'S", in Degrees D°, Minutes M’ and fractionnal Seconds S“ (double precision) with an optionnal Cardinal. When a cardinal is associated to this angle, we consider this angle represents either a Latitude or a Longitude angle.

Fields§

§degrees: u16

Degrees D°

§minutes: u8

Minutes M’

§seconds: f64

Seconds with fractionnal part S“

§cardinal: Option<Cardinal>

Optionnal cardinal associated to this angle

Implementations§

Source§

impl DMS

Source

pub fn new( degrees: u16, minutes: u8, seconds: f64, cardinal: Option<Cardinal>, ) -> DMS

Builds D°M'S" angle, from given D°, M’, S“ values. This method allows overflow, it will wrapp values to correct range itself.

Source

pub fn from_seconds(seconds: f64) -> Self

Builds D°M'S" angle from total amount of seconds

Source

pub fn with_cardinal(&self, cardinal: Cardinal) -> Self

Returns same D°M’S“ angle but attaches a cardinal to it. Useful to convert make this D°M’S“ angle a Latitude or a Longitude.

Source

pub fn from_ddeg_angle(angle: f64) -> Self

Builds D°M’S“ angle from given angle expressed in decimal degrees, with no cardinal associated to returned value

Source

pub fn from_ddeg_latitude(angle: f64) -> Self

Builds Latitude angle, expressed in D°M’S“, from given angle expressed in decimal degrees

Source

pub fn from_ddeg_longitude(angle: f64) -> Self

Builds Longitude angle, expressed in D°M’S“, from given angle expressed in decimal degrees

Source

pub fn to_ddeg_angle(&self) -> f64

Returns Self expressed in decimal degrees If no cardinal is associated, returned angle strictly > 0.

Source

pub fn add_ddeg(&mut self, angle: f64)

Adds given angle to Self, angle expressed a decimal degrees

Source

pub fn with_ddeg_angle(&self, angle: f64) -> Self

Returns copy of Self with given angle added, as decimal degrees

Source

pub fn total_seconds(&self) -> f64

Returns total of seconds (base unit) contained in Self

Source

pub fn to_radians(&self) -> f64

Converts self to radians

Source

pub fn to_europe50(&self) -> Result<DMS, Error>

Returns D°M’S“ angle copy with WGS84 to EU50 conversion applied. For conversion to be applied, we need a cardinal to be associated, otherwise this simply returns a copy

Trait Implementations§

Source§

impl Add<f64> for DMS

Source§

type Output = DMS

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Self

Performs the + operation. Read more
Source§

impl Add for DMS

Source§

type Output = Result<DMS, Error>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Result<Self, Error>

Performs the + operation. Read more
Source§

impl AddAssign<f64> for DMS

Source§

fn add_assign(&mut self, rhs: f64)

Performs the += operation. Read more
Source§

impl AddAssign for DMS

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for DMS

Source§

fn clone(&self) -> DMS

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DMS

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DMS

Source§

fn default() -> Self

Builds null angle with no Cardinal associated to it

Source§

impl Display for DMS

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<f64> for DMS

Source§

type Output = DMS

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> DMS

Performs the / operation. Read more
Source§

impl DivAssign<f64> for DMS

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl From<DMS> for f32

Source§

fn from(val: DMS) -> Self

Converts Self into fractionnal seconds with precision loss

Source§

impl From<DMS> for f64

Source§

fn from(val: DMS) -> Self

Converts Self to decimal degrees

Source§

impl From<DMS> for u16

Source§

fn from(val: DMS) -> Self

Returns total amount of seconds in Self, loosing fractionnal part

Source§

impl From<DMS> for u32

Source§

fn from(val: DMS) -> Self

Returns total amount of seconds in Self, loosing fractionnal part

Source§

impl From<DMS> for u64

Source§

fn from(val: DMS) -> Self

Returns total amount of seconds in Self, loosing fractionnal part

Source§

impl From<DMS> for u8

Source§

fn from(val: DMS) -> Self

Returns total amount of seconds in Self, loosing fractionnal part

Source§

impl Mul<f64> for DMS

Source§

type Output = DMS

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> DMS

Performs the * operation. Read more
Source§

impl MulAssign<f64> for DMS

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl PartialEq for DMS

Source§

fn eq(&self, other: &DMS) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sub<f64> for DMS

Source§

type Output = DMS

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Self

Performs the - operation. Read more
Source§

impl SubAssign<f64> for DMS

Source§

fn sub_assign(&mut self, rhs: f64)

Performs the -= operation. Read more
Source§

impl Copy for DMS

Source§

impl StructuralPartialEq for DMS

Auto Trait Implementations§

§

impl Freeze for DMS

§

impl RefUnwindSafe for DMS

§

impl Send for DMS

§

impl Sync for DMS

§

impl Unpin for DMS

§

impl UnwindSafe for DMS

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.