From 1ce57eedbcbf9a794c472ee3188888b2549396bf Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi <hirrolot@gmail.com> Date: Tue, 28 Jul 2020 01:07:18 +0600 Subject: [PATCH] Add setters to Location --- src/types/location.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/types/location.rs b/src/types/location.rs index b786847a..e34cee1a 100644 --- a/src/types/location.rs +++ b/src/types/location.rs @@ -10,3 +10,19 @@ pub struct Location { /// Latitude as defined by sender. pub latitude: f64, } + +impl Location { + pub fn new(longitude: f64, latitude: f64) -> Self { + Self { longitude, latitude } + } + + pub fn latitude(mut self, val: f64) -> Self { + self.latitude = val; + self + } + + pub fn longitude(mut self, val: f64) -> Self { + self.longitude = val; + self + } +}