#[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 VizActionOption {
#[builder(into)]
#[serde(rename = "label")]
label: String,
#[builder(custom(type = super::VizAction, convert = Box::new))]
#[serde(rename = "action")]
action: Box<super::VizAction>,
#[builder(
default,
custom(
type = impl
Into<Option<super::CommandConfirmation>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "confirmation", skip_serializing_if = "Option::is_none", default)]
confirmation: Option<Box<super::CommandConfirmation>>,
}
impl VizActionOption {
#[inline]
pub fn new(label: impl Into<String>, action: super::VizAction) -> Self {
Self::builder().label(label).action(action).build()
}
#[inline]
pub fn label(&self) -> &str {
&*self.label
}
#[inline]
pub fn action(&self) -> &super::VizAction {
&*self.action
}
#[inline]
pub fn confirmation(&self) -> Option<&super::CommandConfirmation> {
self.confirmation.as_ref().map(|o| &**o)
}
}