DMS

Struct DMS 

Source
pub struct DMS { /* private fields */ }
Expand description

Reader and Writer for degrees, minutes, seconds format, e.g 50°53'39.70''N 10°57'19.23''E.

Degrees, minutes, and seconds are parsed with any number of digits. Optional space characters are accepted between latitude and longitude, between numeric values and the ‘°’, “'”, “''”, and the hemisphere letters.

Implementations§

Source§

impl DMS

Source

pub fn from_reader(reader: &dyn Reader) -> Self

Construct DMS type from Reader’s Coordinates.

Trait Implementations§

Source§

impl Debug for DMS

Custom serializer used in tests.

Source§

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

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

impl Display for DMS

Source§

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

§Examples
use coordfmt::DMS;
fn foo(c: &DMS) -> String {
    println!("{}", c);
    c.to_string()
}
Source§

impl FromStr for DMS

Source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Construct DMS type from string slice.

§Errors
§Examples
use coordfmt::DMS;
use std::str::FromStr;
let a = DMS::from_str("50°53'39.70''N 10°57'19.23''E").unwrap();
let b = "50°53'39.70''N 10°57'19.23''E".parse::<DMS>().unwrap();
Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl Reader for DMS

Source§

fn get_coordinates(&self) -> Coordinates

Retrieve base representation.
Source§

impl Writer 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> 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> 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.