#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct GeoPoint {
#[builder(default, into)]
#[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
label: Option<String>,
#[builder(into)]
#[serde(rename = "icon")]
icon: String,
#[serde(rename = "latitude")]
#[derive_with(with = conjure_object::private::DoubleWrapper)]
latitude: f64,
#[serde(rename = "longitude")]
#[derive_with(with = conjure_object::private::DoubleWrapper)]
longitude: f64,
#[builder(default, list(item(type = super::SecondaryVariable)))]
#[serde(rename = "variables", skip_serializing_if = "Vec::is_empty", default)]
variables: Vec<super::SecondaryVariable>,
}
impl GeoPoint {
#[inline]
pub fn new(icon: impl Into<String>, latitude: f64, longitude: f64) -> Self {
Self::builder().icon(icon).latitude(latitude).longitude(longitude).build()
}
#[inline]
pub fn label(&self) -> Option<&str> {
self.label.as_ref().map(|o| &**o)
}
#[inline]
pub fn icon(&self) -> &str {
&*self.icon
}
#[inline]
pub fn latitude(&self) -> f64 {
self.latitude
}
#[inline]
pub fn longitude(&self) -> f64 {
self.longitude
}
#[inline]
pub fn variables(&self) -> &[super::SecondaryVariable] {
&*self.variables
}
}