Impl From<LatLon> for Coordinate
This commit is contained in:
parent
cd1c1d1d7c
commit
c53f00ea4a
@ -126,6 +126,12 @@ impl Coordinate {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LatLon> for Coordinate {
|
||||
fn from(latlon: LatLon) -> Self {
|
||||
Self::DD(dd::Coordinate::from(latlon))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Coordinate> for LatLon {
|
||||
fn from(value: &Coordinate) -> LatLon {
|
||||
match value {
|
||||
|
@ -52,10 +52,7 @@ impl EncodedAddress {
|
||||
.map_err(|e| e.to_string())?
|
||||
.as_lat_lon();
|
||||
|
||||
|
||||
// TODO: Do not allocate a string here
|
||||
let src_coords =
|
||||
Coordinate::from_str(&format!("{}, {}", lat, lon)).map_err(|e| e.to_string())?;
|
||||
let src_coords = Coordinate::from(LatLon::new(lat, lon).map_err(|e| e.to_string())?);
|
||||
|
||||
Self::try_from(src_coords)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user