pub fn ser_custom_data_identifiers_detections(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::CustomDataIdentifiersDetections,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.count {
object.key("Count").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_1).into()),
);
}
if let Some(var_2) = &input.arn {
object.key("Arn").string(var_2.as_str());
}
if let Some(var_3) = &input.name {
object.key("Name").string(var_3.as_str());
}
if let Some(var_4) = &input.occurrences {
#[allow(unused_mut)]
let mut object_5 = object.key("Occurrences").start_object();
crate::protocol_serde::shape_occurrences::ser_occurrences(&mut object_5, var_4)?;
object_5.finish();
}
Ok(())
}
pub(crate) fn de_custom_data_identifiers_detections<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::CustomDataIdentifiersDetections>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::CustomDataIdentifiersDetectionsBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"Count" => {
builder = builder.set_count(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i64::try_from)
.transpose()?,
);
}
"Arn" => {
builder = builder.set_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Name" => {
builder = builder.set_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Occurrences" => {
builder = builder.set_occurrences(crate::protocol_serde::shape_occurrences::de_occurrences(tokens, _value)?);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
}
Ok(Some(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}