Skip to content

Commit d08cde0

Browse files
committed
Add country_code, hint and areas to Location
1 parent 4611401 commit d08cde0

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/status.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ use crate::sensors::Sensors;
77

88
type Extensions = BTreeMap<String, Value>;
99

10+
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq)]
11+
pub struct Area {
12+
#[serde(skip_serializing_if = "Option::is_none")]
13+
name: Option<String>,
14+
#[serde(skip_serializing_if = "Option::is_none")]
15+
description: Option<String>,
16+
square_meters: f64,
17+
}
18+
1019
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq)]
1120
pub struct Location {
1221
#[serde(skip_serializing_if = "Option::is_none")]
@@ -15,6 +24,12 @@ pub struct Location {
1524
pub lon: f64,
1625
#[serde(skip_serializing_if = "Option::is_none")]
1726
pub timezone: Option<String>,
27+
#[serde(skip_serializing_if = "Option::is_none")]
28+
pub country_code: Option<String>,
29+
#[serde(skip_serializing_if = "Option::is_none")]
30+
pub hint: Option<String>,
31+
#[serde(skip_serializing_if = "Option::is_none")]
32+
pub areas: Option<Vec<Area>>,
1833
}
1934

2035
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
@@ -976,6 +991,15 @@ mod test {
976991
},
977992
r#"{"ustream":"http://www.ustream.tv/channel/hackspsps"}"#
978993
);
994+
995+
test_serialize!(
996+
area,
997+
Area {
998+
square_meters: 120.0,
999+
..Area::default()
1000+
},
1001+
r#"{"square_meters":120.0}"#
1002+
);
9791003
}
9801004

9811005
mod deserialize {

0 commit comments

Comments
 (0)