smarty_rust_sdk/us_reverse_geo_api/
lookup.rs1use crate::sdk::has_param;
2use crate::us_reverse_geo_api::address::Results;
3
4#[derive(Debug, Clone, PartialEq)]
5pub struct Lookup {
6 pub latitude: f64,
7 pub longitude: f64,
8 pub source: String,
9 pub results: Results,
10}
11
12impl Default for Lookup {
13 fn default() -> Self {
14 Lookup {
15 latitude: 0.0,
16 longitude: 0.0,
17 source: String::default(),
18 results: Results { results: vec![] },
19 }
20 }
21}
22
23impl Lookup {
24 pub(crate) fn into_param_array(self) -> Vec<(String, String)> {
25 let mut result = vec![
26 ("latitude".to_string(), self.latitude.to_string()),
27 ("longitude".to_string(), self.longitude.to_string()),
28 ];
29
30 if let Some(source_string) = has_param("source".to_string(), self.source) {
31 result.push(source_string)
32 }
33
34 result
35 }
36}