#[derive(
Clone,
Default,
PartialEq,
serde::Deserialize,
serde::Serialize,
std::fmt::Debug
)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DeviceRequestAc {
#[serde(skip_serializing_if = "Option::is_none")]
pub exactly: Option<
<::k8s_openapi027::api::resource::v1beta2::ExactDeviceRequest as crate::Optionable>::Optioned,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_available: Option<
std::vec::Vec<
<::k8s_openapi027::api::resource::v1beta2::DeviceSubRequest as crate::Optionable>::Optioned,
>,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<std::string::String>,
}
#[automatically_derived]
impl crate::Optionable for k8s_openapi027::api::resource::v1beta2::DeviceRequest {
type Optioned = DeviceRequestAc;
}
#[automatically_derived]
impl crate::Optionable for DeviceRequestAc {
type Optioned = DeviceRequestAc;
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionableConvert for k8s_openapi027::api::resource::v1beta2::DeviceRequest {
fn into_optioned(self) -> DeviceRequestAc {
DeviceRequestAc {
exactly: crate::OptionableConvert::into_optioned(self.exactly),
first_available: crate::OptionableConvert::into_optioned(
self.first_available,
),
name: Some(self.name),
}
}
fn try_from_optioned(value: DeviceRequestAc) -> Result<Self, crate::Error> {
Ok(Self {
exactly: crate::OptionableConvert::try_from_optioned(value.exactly)?,
first_available: crate::OptionableConvert::try_from_optioned(
value.first_available,
)?,
name: value
.name
.ok_or(crate::Error {
missing_field: "name",
})?,
})
}
fn merge(&mut self, other: DeviceRequestAc) -> Result<(), crate::Error> {
if self.exactly.is_none() {
self.exactly = crate::OptionableConvert::try_from_optioned(other.exactly)?;
} else if let Some(self_value) = self.exactly.as_mut()
&& let Some(other_value) = other.exactly
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.first_available.is_none() {
self.first_available = crate::OptionableConvert::try_from_optioned(
other.first_available,
)?;
} else if let Some(self_value) = self.first_available.as_mut()
&& let Some(other_value) = other.first_available
{
*self_value = crate::OptionableConvert::try_from_optioned(other_value)?;
}
if let Some(other_value) = other.name {
self.name = crate::OptionableConvert::try_from_optioned(other_value)?;
}
Ok(())
}
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionedConvert<k8s_openapi027::api::resource::v1beta2::DeviceRequest>
for DeviceRequestAc {
fn from_optionable(
value: k8s_openapi027::api::resource::v1beta2::DeviceRequest,
) -> Self {
crate::OptionableConvert::into_optioned(value)
}
fn try_into_optionable(
self,
) -> Result<k8s_openapi027::api::resource::v1beta2::DeviceRequest, crate::Error> {
crate::OptionableConvert::try_from_optioned(self)
}
fn merge_into(
self,
other: &mut k8s_openapi027::api::resource::v1beta2::DeviceRequest,
) -> Result<(), crate::Error> {
crate::OptionableConvert::merge(other, self)
}
}