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 {
|
impl From<&Coordinate> for LatLon {
|
||||||
fn from(value: &Coordinate) -> LatLon {
|
fn from(value: &Coordinate) -> LatLon {
|
||||||
match value {
|
match value {
|
||||||
|
@ -52,10 +52,7 @@ impl EncodedAddress {
|
|||||||
.map_err(|e| e.to_string())?
|
.map_err(|e| e.to_string())?
|
||||||
.as_lat_lon();
|
.as_lat_lon();
|
||||||
|
|
||||||
|
let src_coords = Coordinate::from(LatLon::new(lat, lon).map_err(|e| e.to_string())?);
|
||||||
// TODO: Do not allocate a string here
|
|
||||||
let src_coords =
|
|
||||||
Coordinate::from_str(&format!("{}, {}", lat, lon)).map_err(|e| e.to_string())?;
|
|
||||||
|
|
||||||
Self::try_from(src_coords)
|
Self::try_from(src_coords)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user