nominal_api/conjure/objects/scout/chartdefinition/api/
geo_point.rs1#[derive(
3 Debug,
4 Clone,
5 conjure_object::serde::Serialize,
6 conjure_object::serde::Deserialize,
7 conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct GeoPoint {
14 #[builder(default, into)]
15 #[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
16 label: Option<String>,
17 #[builder(into)]
18 #[serde(rename = "icon")]
19 icon: String,
20 #[serde(rename = "latitude")]
21 #[derive_with(with = conjure_object::private::DoubleWrapper)]
22 latitude: f64,
23 #[serde(rename = "longitude")]
24 #[derive_with(with = conjure_object::private::DoubleWrapper)]
25 longitude: f64,
26 #[builder(default, list(item(type = super::SecondaryVariable)))]
27 #[serde(rename = "variables", skip_serializing_if = "Vec::is_empty", default)]
28 variables: Vec<super::SecondaryVariable>,
29}
30impl GeoPoint {
31 #[inline]
33 pub fn new(icon: impl Into<String>, latitude: f64, longitude: f64) -> Self {
34 Self::builder().icon(icon).latitude(latitude).longitude(longitude).build()
35 }
36 #[inline]
37 pub fn label(&self) -> Option<&str> {
38 self.label.as_ref().map(|o| &**o)
39 }
40 #[inline]
41 pub fn icon(&self) -> &str {
42 &*self.icon
43 }
44 #[inline]
45 pub fn latitude(&self) -> f64 {
46 self.latitude
47 }
48 #[inline]
49 pub fn longitude(&self) -> f64 {
50 self.longitude
51 }
52 #[inline]
53 pub fn variables(&self) -> &[super::SecondaryVariable] {
54 &*self.variables
55 }
56}