Skip to content

Commit

Permalink
feat: conversions for LatLng and Waypoint, Location
Browse files Browse the repository at this point in the history
  • Loading branch information
leontoeides committed Jul 25, 2024
1 parent 7ba3988 commit 10c3c25
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* Release notes are available on
[GitHub](https://github.com/leontoeides/google_maps/releases).

# 3.5.4
# 3.5.5

* 2024-06-15: This crate now instructs `serde` to not serialize empty fields.
This may potentially save a bit of disk space and bandwidth.
* 2024-07-25: Added additional conversion traits between `Location` & `Waypoint`
and `LatLng` for improved ergonomics.

# 3.5.4

* 2024-07-25: Added support for getting `LatLng` structs from tuples
`(43.68, 7.32)`
Expand All @@ -15,6 +17,12 @@

* 2024-07-25: Dependency bumps

* 2024-07-19: Adjusts `reqwest` client's default timeouts for more reliable
operation.

* 2024-06-15: This crate now instructs `serde` to not serialize empty fields.
This may potentially save a bit of disk space and bandwidth.

# 3.5.3

* 2024-06-09: Increased flexibility of interface by using more `impl Into<Type>`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "google_maps"
version = "3.5.4"
version = "3.5.5"
authors = [ "Dylan Bowker <dylan.bowker@arkiteq.ca>" ]
edition = "2021"
categories = [ "api-bindings" ]
Expand Down
18 changes: 18 additions & 0 deletions src/directions/request/location/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,21 @@ impl Location {
Ok(Self::LatLng(latlng))
} // fn
} // impl

// -----------------------------------------------------------------------------

impl From<LatLng> for Location {
/// Converts an owned `LatLng` coordinates type into a `Location` type.
fn from(latlng: LatLng) -> Self {
Self::LatLng(latlng)
} // fn
} // impl

// -----------------------------------------------------------------------------

impl From<&LatLng> for Location {
/// Converts a borrowed `&LatLng` coordinates type into a `Location` type.
fn from(latlng: &LatLng) -> Self {
Self::LatLng(*latlng)
} // fn
} // impl
18 changes: 18 additions & 0 deletions src/directions/request/waypoint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,21 @@ impl Waypoint {
Ok(Self::LatLng(latlng))
} // fn
} // impl

// -----------------------------------------------------------------------------

impl From<LatLng> for Waypoint {
/// Converts an owned `LatLng` coordinates type into a `Waypoint` type.
fn from(latlng: LatLng) -> Self {
Self::LatLng(latlng)
} // fn
} // impl

// -----------------------------------------------------------------------------

impl From<&LatLng> for Waypoint {
/// Converts a borrowed `&LatLng` coordinates type into a `Waypoint` type.
fn from(latlng: &LatLng) -> Self {
Self::LatLng(*latlng)
} // fn
} // impl

0 comments on commit 10c3c25

Please sign in to comment.