@@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
11
11
#[ skip_serializing_none]
12
12
#[ derive( Clone , Debug , PartialEq , Serialize ) ]
13
13
pub struct GeomapWidgetDefinitionView {
14
+ /// A custom extent of the map defined by an array of four numbers in the order `[minLongitude, minLatitude, maxLongitude, maxLatitude]`.
15
+ #[ serde( rename = "custom_extent" ) ]
16
+ pub custom_extent : Option < Vec < f64 > > ,
14
17
/// The 2-letter ISO code of a country to focus the map on. Or `WORLD`.
15
18
#[ serde( rename = "focus" ) ]
16
19
pub focus : String ,
@@ -24,12 +27,18 @@ pub struct GeomapWidgetDefinitionView {
24
27
impl GeomapWidgetDefinitionView {
25
28
pub fn new ( focus : String ) -> GeomapWidgetDefinitionView {
26
29
GeomapWidgetDefinitionView {
30
+ custom_extent : None ,
27
31
focus,
28
32
additional_properties : std:: collections:: BTreeMap :: new ( ) ,
29
33
_unparsed : false ,
30
34
}
31
35
}
32
36
37
+ pub fn custom_extent ( mut self , value : Vec < f64 > ) -> Self {
38
+ self . custom_extent = Some ( value) ;
39
+ self
40
+ }
41
+
33
42
pub fn additional_properties (
34
43
mut self ,
35
44
value : std:: collections:: BTreeMap < String , serde_json:: Value > ,
@@ -56,6 +65,7 @@ impl<'de> Deserialize<'de> for GeomapWidgetDefinitionView {
56
65
where
57
66
M : MapAccess < ' a > ,
58
67
{
68
+ let mut custom_extent: Option < Vec < f64 > > = None ;
59
69
let mut focus: Option < String > = None ;
60
70
let mut additional_properties: std:: collections:: BTreeMap <
61
71
String ,
@@ -65,6 +75,13 @@ impl<'de> Deserialize<'de> for GeomapWidgetDefinitionView {
65
75
66
76
while let Some ( ( k, v) ) = map. next_entry :: < String , serde_json:: Value > ( ) ? {
67
77
match k. as_str ( ) {
78
+ "custom_extent" => {
79
+ if v. is_null ( ) {
80
+ continue ;
81
+ }
82
+ custom_extent =
83
+ Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
84
+ }
68
85
"focus" => {
69
86
focus = Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
70
87
}
@@ -78,6 +95,7 @@ impl<'de> Deserialize<'de> for GeomapWidgetDefinitionView {
78
95
let focus = focus. ok_or_else ( || M :: Error :: missing_field ( "focus" ) ) ?;
79
96
80
97
let content = GeomapWidgetDefinitionView {
98
+ custom_extent,
81
99
focus,
82
100
additional_properties,
83
101
_unparsed,
0 commit comments