#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct DeviceComponent {
pub id: Option<super::primitives::Id>,
pub meta: Option<super::meta::Meta>,
pub implicit_rules: Option<super::primitives::Uri>,
pub language: Option<super::primitives::Code>,
pub text: Option<super::narrative::Narrative>,
pub contained: Vec<super::resource::Resource>,
pub extension: Vec<super::extension::Extension>,
pub modifier_extension: Vec<super::extension::Extension>,
pub identifier: super::identifier::Identifier,
pub r#type: super::codeable_concept::CodeableConcept,
pub last_system_change: Option<super::primitives::Instant>,
pub source: Option<super::reference::Reference>,
pub parent: Option<super::reference::Reference>,
pub operational_status: Vec<super::codeable_concept::CodeableConcept>,
pub parameter_group: Option<super::codeable_concept::CodeableConcept>,
pub measurement_principle: Option<super::primitives::Code>,
pub production_specification: Vec<DeviceComponentProductionSpecification>,
pub language_code: Option<super::codeable_concept::CodeableConcept>,
}
impl super::super::codec::Json for DeviceComponent {
fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
let mut object = super::super::codec::Object::new();
object.insert(
std::string::String::from("resourceType"),
super::super::codec::Value::String(std::string::String::from("DeviceComponent")),
);
if let Some(item) = &self.id {
if let Some(v) = super::super::codec::Primitive::value_json(item)? {
object.insert(std::string::String::from("id"), v);
}
if let Some(e) = super::super::codec::Primitive::element_json(item)? {
object.insert(std::string::String::from("_id"), e);
}
}
if let Some(item) = &self.meta {
object.insert(
std::string::String::from("meta"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if let Some(item) = &self.implicit_rules {
if let Some(v) = super::super::codec::Primitive::value_json(item)? {
object.insert(std::string::String::from("implicitRules"), v);
}
if let Some(e) = super::super::codec::Primitive::element_json(item)? {
object.insert(std::string::String::from("_implicitRules"), e);
}
}
if let Some(item) = &self.language {
if let Some(v) = super::super::codec::Primitive::value_json(item)? {
object.insert(std::string::String::from("language"), v);
}
if let Some(e) = super::super::codec::Primitive::element_json(item)? {
object.insert(std::string::String::from("_language"), e);
}
}
if let Some(item) = &self.text {
object.insert(
std::string::String::from("text"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if !self.contained.is_empty() {
let mut items = Vec::with_capacity(self.contained.len());
for item in &self.contained {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("contained"),
super::super::codec::Value::Array(items),
);
}
if !self.extension.is_empty() {
let mut items = Vec::with_capacity(self.extension.len());
for item in &self.extension {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("extension"),
super::super::codec::Value::Array(items),
);
}
if !self.modifier_extension.is_empty() {
let mut items = Vec::with_capacity(self.modifier_extension.len());
for item in &self.modifier_extension {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("modifierExtension"),
super::super::codec::Value::Array(items),
);
}
object.insert(
std::string::String::from("identifier"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(
&self.identifier,
)?),
);
object.insert(
std::string::String::from("type"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(&self.r#type)?),
);
if let Some(item) = &self.last_system_change {
if let Some(v) = super::super::codec::Primitive::value_json(item)? {
object.insert(std::string::String::from("lastSystemChange"), v);
}
if let Some(e) = super::super::codec::Primitive::element_json(item)? {
object.insert(std::string::String::from("_lastSystemChange"), e);
}
}
if let Some(item) = &self.source {
object.insert(
std::string::String::from("source"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if let Some(item) = &self.parent {
object.insert(
std::string::String::from("parent"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if !self.operational_status.is_empty() {
let mut items = Vec::with_capacity(self.operational_status.len());
for item in &self.operational_status {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("operationalStatus"),
super::super::codec::Value::Array(items),
);
}
if let Some(item) = &self.parameter_group {
object.insert(
std::string::String::from("parameterGroup"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if let Some(item) = &self.measurement_principle {
if let Some(v) = super::super::codec::Primitive::value_json(item)? {
object.insert(std::string::String::from("measurementPrinciple"), v);
}
if let Some(e) = super::super::codec::Primitive::element_json(item)? {
object.insert(std::string::String::from("_measurementPrinciple"), e);
}
}
if !self.production_specification.is_empty() {
let mut items = Vec::with_capacity(self.production_specification.len());
for item in &self.production_specification {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("productionSpecification"),
super::super::codec::Value::Array(items),
);
}
if let Some(item) = &self.language_code {
object.insert(
std::string::String::from("languageCode"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
Ok(object)
}
fn from_json(
object: &super::super::codec::Object,
path: &mut super::super::codec::Path,
) -> Result<Self, super::super::codec::DecodeError> {
let mut raw_id: Option<&super::super::codec::Value> = None;
let mut raw_id_element: Option<&super::super::codec::Value> = None;
let mut raw_meta: Option<&super::super::codec::Value> = None;
let mut raw_implicit_rules: Option<&super::super::codec::Value> = None;
let mut raw_implicit_rules_element: Option<&super::super::codec::Value> = None;
let mut raw_language: Option<&super::super::codec::Value> = None;
let mut raw_language_element: Option<&super::super::codec::Value> = None;
let mut raw_text: Option<&super::super::codec::Value> = None;
let mut raw_contained: Option<&super::super::codec::Value> = None;
let mut raw_extension: Option<&super::super::codec::Value> = None;
let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
let mut raw_identifier: Option<&super::super::codec::Value> = None;
let mut raw_type: Option<&super::super::codec::Value> = None;
let mut raw_last_system_change: Option<&super::super::codec::Value> = None;
let mut raw_last_system_change_element: Option<&super::super::codec::Value> = None;
let mut raw_source: Option<&super::super::codec::Value> = None;
let mut raw_parent: Option<&super::super::codec::Value> = None;
let mut raw_operational_status: Option<&super::super::codec::Value> = None;
let mut raw_parameter_group: Option<&super::super::codec::Value> = None;
let mut raw_measurement_principle: Option<&super::super::codec::Value> = None;
let mut raw_measurement_principle_element: Option<&super::super::codec::Value> = None;
let mut raw_production_specification: Option<&super::super::codec::Value> = None;
let mut raw_language_code: Option<&super::super::codec::Value> = None;
for (key, value) in object {
match key.as_str() {
"resourceType" => {
if value.as_str() != Some("DeviceComponent") {
return Err(path.error(super::super::codec::DecodeErrorKind::ResourceType));
}
}
"id" => {
raw_id = Some(value);
}
"_id" => {
raw_id_element = Some(value);
}
"meta" => {
raw_meta = Some(value);
}
"implicitRules" => {
raw_implicit_rules = Some(value);
}
"_implicitRules" => {
raw_implicit_rules_element = Some(value);
}
"language" => {
raw_language = Some(value);
}
"_language" => {
raw_language_element = Some(value);
}
"text" => {
raw_text = Some(value);
}
"contained" => {
raw_contained = Some(value);
}
"extension" => {
raw_extension = Some(value);
}
"modifierExtension" => {
raw_modifier_extension = Some(value);
}
"identifier" => {
raw_identifier = Some(value);
}
"type" => {
raw_type = Some(value);
}
"lastSystemChange" => {
raw_last_system_change = Some(value);
}
"_lastSystemChange" => {
raw_last_system_change_element = Some(value);
}
"source" => {
raw_source = Some(value);
}
"parent" => {
raw_parent = Some(value);
}
"operationalStatus" => {
raw_operational_status = Some(value);
}
"parameterGroup" => {
raw_parameter_group = Some(value);
}
"measurementPrinciple" => {
raw_measurement_principle = Some(value);
}
"_measurementPrinciple" => {
raw_measurement_principle_element = Some(value);
}
"productionSpecification" => {
raw_production_specification = Some(value);
}
"languageCode" => {
raw_language_code = Some(value);
}
other => {
return path.with(other, |path| {
Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
});
}
}
}
let field_id = match (raw_id, raw_id_element) {
(None, None) => None,
(value, element) => Some(path.with("id", |path| {
super::super::codec::Primitive::from_json_parts(value, element, path)
})?),
};
let field_meta = raw_meta
.map(|value| {
path.with("meta", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let field_implicit_rules = match (raw_implicit_rules, raw_implicit_rules_element) {
(None, None) => None,
(value, element) => Some(path.with("implicitRules", |path| {
super::super::codec::Primitive::from_json_parts(value, element, path)
})?),
};
let field_language = match (raw_language, raw_language_element) {
(None, None) => None,
(value, element) => Some(path.with("language", |path| {
super::super::codec::Primitive::from_json_parts(value, element, path)
})?),
};
let field_text = raw_text
.map(|value| {
path.with("text", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let mut field_contained = Vec::new();
if let Some(raw) = raw_contained {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_contained.push(path.with_index("contained", index, |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
})?);
}
}
let mut field_extension = Vec::new();
if let Some(raw) = raw_extension {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_extension.push(path.with_index("extension", index, |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
})?);
}
}
let mut field_modifier_extension = Vec::new();
if let Some(raw) = raw_modifier_extension {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_modifier_extension.push(path.with_index(
"modifierExtension",
index,
|path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
},
)?);
}
}
let field_identifier = path.with("identifier", |path| {
let value = raw_identifier
.ok_or_else(|| path.error(super::super::codec::DecodeErrorKind::MissingProperty))?;
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})?;
let field_type = path.with("type", |path| {
let value = raw_type
.ok_or_else(|| path.error(super::super::codec::DecodeErrorKind::MissingProperty))?;
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})?;
let field_last_system_change =
match (raw_last_system_change, raw_last_system_change_element) {
(None, None) => None,
(value, element) => Some(path.with("lastSystemChange", |path| {
super::super::codec::Primitive::from_json_parts(value, element, path)
})?),
};
let field_source = raw_source
.map(|value| {
path.with("source", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let field_parent = raw_parent
.map(|value| {
path.with("parent", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let mut field_operational_status = Vec::new();
if let Some(raw) = raw_operational_status {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_operational_status.push(path.with_index(
"operationalStatus",
index,
|path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
},
)?);
}
}
let field_parameter_group = raw_parameter_group
.map(|value| {
path.with("parameterGroup", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let field_measurement_principle =
match (raw_measurement_principle, raw_measurement_principle_element) {
(None, None) => None,
(value, element) => Some(path.with("measurementPrinciple", |path| {
super::super::codec::Primitive::from_json_parts(value, element, path)
})?),
};
let mut field_production_specification = Vec::new();
if let Some(raw) = raw_production_specification {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_production_specification.push(path.with_index(
"productionSpecification",
index,
|path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
},
)?);
}
}
let field_language_code = raw_language_code
.map(|value| {
path.with("languageCode", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
Ok(Self {
id: field_id,
meta: field_meta,
implicit_rules: field_implicit_rules,
language: field_language,
text: field_text,
contained: field_contained,
extension: field_extension,
modifier_extension: field_modifier_extension,
identifier: field_identifier,
r#type: field_type,
last_system_change: field_last_system_change,
source: field_source,
parent: field_parent,
operational_status: field_operational_status,
parameter_group: field_parameter_group,
measurement_principle: field_measurement_principle,
production_specification: field_production_specification,
language_code: field_language_code,
})
}
}
impl serde::Serialize for DeviceComponent {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut map = serde::Serializer::serialize_map(serializer, None)?;
if let Some(item) = &self.id {
super::super::codec::element_entry(&mut map, "_id", item)?;
}
if let Some(item) = &self.implicit_rules {
super::super::codec::element_entry(&mut map, "_implicitRules", item)?;
}
if let Some(item) = &self.language {
super::super::codec::element_entry(&mut map, "_language", item)?;
}
if let Some(item) = &self.last_system_change {
super::super::codec::element_entry(&mut map, "_lastSystemChange", item)?;
}
if let Some(item) = &self.measurement_principle {
super::super::codec::element_entry(&mut map, "_measurementPrinciple", item)?;
}
if !self.contained.is_empty() {
serde::ser::SerializeMap::serialize_entry(&mut map, "contained", &self.contained)?;
}
if !self.extension.is_empty() {
serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
}
if let Some(item) = &self.id {
super::super::codec::value_entry(&mut map, "id", item)?;
}
serde::ser::SerializeMap::serialize_entry(&mut map, "identifier", &self.identifier)?;
if let Some(item) = &self.implicit_rules {
super::super::codec::value_entry(&mut map, "implicitRules", item)?;
}
if let Some(item) = &self.language {
super::super::codec::value_entry(&mut map, "language", item)?;
}
if let Some(item) = &self.language_code {
serde::ser::SerializeMap::serialize_entry(&mut map, "languageCode", item)?;
}
if let Some(item) = &self.last_system_change {
super::super::codec::value_entry(&mut map, "lastSystemChange", item)?;
}
if let Some(item) = &self.measurement_principle {
super::super::codec::value_entry(&mut map, "measurementPrinciple", item)?;
}
if let Some(item) = &self.meta {
serde::ser::SerializeMap::serialize_entry(&mut map, "meta", item)?;
}
if !self.modifier_extension.is_empty() {
serde::ser::SerializeMap::serialize_entry(
&mut map,
"modifierExtension",
&self.modifier_extension,
)?;
}
if !self.operational_status.is_empty() {
serde::ser::SerializeMap::serialize_entry(
&mut map,
"operationalStatus",
&self.operational_status,
)?;
}
if let Some(item) = &self.parameter_group {
serde::ser::SerializeMap::serialize_entry(&mut map, "parameterGroup", item)?;
}
if let Some(item) = &self.parent {
serde::ser::SerializeMap::serialize_entry(&mut map, "parent", item)?;
}
if !self.production_specification.is_empty() {
serde::ser::SerializeMap::serialize_entry(
&mut map,
"productionSpecification",
&self.production_specification,
)?;
}
serde::ser::SerializeMap::serialize_entry(&mut map, "resourceType", "DeviceComponent")?;
if let Some(item) = &self.source {
serde::ser::SerializeMap::serialize_entry(&mut map, "source", item)?;
}
if let Some(item) = &self.text {
serde::ser::SerializeMap::serialize_entry(&mut map, "text", item)?;
}
serde::ser::SerializeMap::serialize_entry(&mut map, "type", &self.r#type)?;
serde::ser::SerializeMap::end(map)
}
}
impl<'de> serde::Deserialize<'de> for DeviceComponent {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
let mut path = super::super::codec::Path::root("DeviceComponent");
let object =
super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
}
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct DeviceComponentProductionSpecification {
pub id: Option<std::string::String>,
pub extension: Vec<super::extension::Extension>,
pub modifier_extension: Vec<super::extension::Extension>,
pub spec_type: Option<super::codeable_concept::CodeableConcept>,
pub component_id: Option<super::identifier::Identifier>,
pub production_spec: Option<super::primitives::String>,
}
impl super::super::codec::Json for DeviceComponentProductionSpecification {
fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
let mut object = super::super::codec::Object::new();
if let Some(v) = &self.id {
object.insert(
std::string::String::from("id"),
super::super::codec::Value::String(v.clone()),
);
}
if !self.extension.is_empty() {
let mut items = Vec::with_capacity(self.extension.len());
for item in &self.extension {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("extension"),
super::super::codec::Value::Array(items),
);
}
if !self.modifier_extension.is_empty() {
let mut items = Vec::with_capacity(self.modifier_extension.len());
for item in &self.modifier_extension {
items.push(super::super::codec::Value::Object(
super::super::codec::Json::to_json(item)?,
));
}
object.insert(
std::string::String::from("modifierExtension"),
super::super::codec::Value::Array(items),
);
}
if let Some(item) = &self.spec_type {
object.insert(
std::string::String::from("specType"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if let Some(item) = &self.component_id {
object.insert(
std::string::String::from("componentId"),
super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
);
}
if let Some(item) = &self.production_spec {
if let Some(v) = super::super::codec::Primitive::value_json(item)? {
object.insert(std::string::String::from("productionSpec"), v);
}
if let Some(e) = super::super::codec::Primitive::element_json(item)? {
object.insert(std::string::String::from("_productionSpec"), e);
}
}
Ok(object)
}
fn from_json(
object: &super::super::codec::Object,
path: &mut super::super::codec::Path,
) -> Result<Self, super::super::codec::DecodeError> {
let mut raw_id: Option<&super::super::codec::Value> = None;
let mut raw_extension: Option<&super::super::codec::Value> = None;
let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
let mut raw_spec_type: Option<&super::super::codec::Value> = None;
let mut raw_component_id: Option<&super::super::codec::Value> = None;
let mut raw_production_spec: Option<&super::super::codec::Value> = None;
let mut raw_production_spec_element: Option<&super::super::codec::Value> = None;
for (key, value) in object {
match key.as_str() {
"id" => {
raw_id = Some(value);
}
"extension" => {
raw_extension = Some(value);
}
"modifierExtension" => {
raw_modifier_extension = Some(value);
}
"specType" => {
raw_spec_type = Some(value);
}
"componentId" => {
raw_component_id = Some(value);
}
"productionSpec" => {
raw_production_spec = Some(value);
}
"_productionSpec" => {
raw_production_spec_element = Some(value);
}
other => {
return path.with(other, |path| {
Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
});
}
}
}
let field_id = raw_id
.map(|value| {
path.with("id", |path| {
let value = super::super::codec::expect_single(value, path)?;
super::super::codec::expect_string(value, path)
})
})
.transpose()?;
let mut field_extension = Vec::new();
if let Some(raw) = raw_extension {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_extension.push(path.with_index("extension", index, |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
})?);
}
}
let mut field_modifier_extension = Vec::new();
if let Some(raw) = raw_modifier_extension {
for (index, value) in super::super::codec::expect_array(raw, path)?
.iter()
.enumerate()
{
field_modifier_extension.push(path.with_index(
"modifierExtension",
index,
|path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(value, path)?,
path,
)
},
)?);
}
}
let field_spec_type = raw_spec_type
.map(|value| {
path.with("specType", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let field_component_id = raw_component_id
.map(|value| {
path.with("componentId", |path| {
super::super::codec::Json::from_json(
super::super::codec::expect_object(
super::super::codec::expect_single(value, path)?,
path,
)?,
path,
)
})
})
.transpose()?;
let field_production_spec = match (raw_production_spec, raw_production_spec_element) {
(None, None) => None,
(value, element) => Some(path.with("productionSpec", |path| {
super::super::codec::Primitive::from_json_parts(value, element, path)
})?),
};
Ok(Self {
id: field_id,
extension: field_extension,
modifier_extension: field_modifier_extension,
spec_type: field_spec_type,
component_id: field_component_id,
production_spec: field_production_spec,
})
}
}
impl serde::Serialize for DeviceComponentProductionSpecification {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut map = serde::Serializer::serialize_map(serializer, None)?;
if let Some(item) = &self.production_spec {
super::super::codec::element_entry(&mut map, "_productionSpec", item)?;
}
if let Some(item) = &self.component_id {
serde::ser::SerializeMap::serialize_entry(&mut map, "componentId", item)?;
}
if !self.extension.is_empty() {
serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
}
if let Some(v) = &self.id {
serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
}
if !self.modifier_extension.is_empty() {
serde::ser::SerializeMap::serialize_entry(
&mut map,
"modifierExtension",
&self.modifier_extension,
)?;
}
if let Some(item) = &self.production_spec {
super::super::codec::value_entry(&mut map, "productionSpec", item)?;
}
if let Some(item) = &self.spec_type {
serde::ser::SerializeMap::serialize_entry(&mut map, "specType", item)?;
}
serde::ser::SerializeMap::end(map)
}
}
impl<'de> serde::Deserialize<'de> for DeviceComponentProductionSpecification {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
let mut path = super::super::codec::Path::root("DeviceComponentProductionSpecification");
let object =
super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
}
}