Skip to main content

parse_dms

Function parse_dms 

Source
pub fn parse_dms(input: &str) -> Result<Dms, ParseError>
Expand description

Parse a coordinate string into decimal degrees.

Returns Dms::Decimal for a single hemisphere-less coordinate, otherwise Dms::Coordinates with the inferred latitude and/or longitude.

ยงErrors

Returns ParseError if the string cannot be parsed or a component is out of range.

assert_eq!(parse_dms("51 N").unwrap(), Dms::Coordinates { lat: Some(51.0), lon: None });
assert!(parse_dms("foo").is_err());