optionable 0.14.0

Derive macro (and associated marker trait) to derive nested structs/enums with all subfields being optional (e.g. for patches or Kubernetes server side apply).
Documentation
#[derive(
    Clone,
    Default,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    std::fmt::Debug
)]
/// AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct AggregationRuleAc {
    /// ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cluster_role_selectors: Option<
        std::vec::Vec<
            <::k8s_openapi027::apimachinery::pkg::apis::meta::v1::LabelSelector as crate::Optionable>::Optioned,
        >,
    >,
}
#[automatically_derived]
impl crate::Optionable for k8s_openapi027::api::rbac::v1::AggregationRule {
    type Optioned = AggregationRuleAc;
}
#[automatically_derived]
impl crate::Optionable for AggregationRuleAc {
    type Optioned = AggregationRuleAc;
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionableConvert for k8s_openapi027::api::rbac::v1::AggregationRule {
    fn into_optioned(self) -> AggregationRuleAc {
        AggregationRuleAc {
            cluster_role_selectors: crate::OptionableConvert::into_optioned(
                self.cluster_role_selectors,
            ),
        }
    }
    fn try_from_optioned(value: AggregationRuleAc) -> Result<Self, crate::Error> {
        Ok(Self {
            cluster_role_selectors: crate::OptionableConvert::try_from_optioned(
                value.cluster_role_selectors,
            )?,
        })
    }
    fn merge(&mut self, other: AggregationRuleAc) -> Result<(), crate::Error> {
        if self.cluster_role_selectors.is_none() {
            self.cluster_role_selectors = crate::OptionableConvert::try_from_optioned(
                other.cluster_role_selectors,
            )?;
        } else if let Some(self_value) = self.cluster_role_selectors.as_mut()
            && let Some(other_value) = other.cluster_role_selectors
        {
            *self_value = crate::OptionableConvert::try_from_optioned(other_value)?;
        }
        Ok(())
    }
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionedConvert<k8s_openapi027::api::rbac::v1::AggregationRule>
for AggregationRuleAc {
    fn from_optionable(value: k8s_openapi027::api::rbac::v1::AggregationRule) -> Self {
        crate::OptionableConvert::into_optioned(value)
    }
    fn try_into_optionable(
        self,
    ) -> Result<k8s_openapi027::api::rbac::v1::AggregationRule, crate::Error> {
        crate::OptionableConvert::try_from_optioned(self)
    }
    fn merge_into(
        self,
        other: &mut k8s_openapi027::api::rbac::v1::AggregationRule,
    ) -> Result<(), crate::Error> {
        crate::OptionableConvert::merge(other, self)
    }
}