pub(crate) fn de_rule_based_matching_response<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::RuleBasedMatchingResponse>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
if depth >= 128u32 {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"maximum nesting depth exceeded",
));
}
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::RuleBasedMatchingResponseBuilder::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() {
"Enabled" => {
builder = builder.set_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"MatchingRules" => {
builder = builder.set_matching_rules(crate::protocol_serde::shape_matching_rules::de_matching_rules(
tokens,
_value,
depth + 1,
)?);
}
"Status" => {
builder = builder.set_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::RuleBasedMatchingStatus::from(u.as_ref())))
.transpose()?,
);
}
"MaxAllowedRuleLevelForMerging" => {
builder = builder.set_max_allowed_rule_level_for_merging(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"MaxAllowedRuleLevelForMatching" => {
builder = builder.set_max_allowed_rule_level_for_matching(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"AttributeTypesSelector" => {
builder = builder.set_attribute_types_selector(
crate::protocol_serde::shape_attribute_types_selector::de_attribute_types_selector(tokens, _value, depth + 1)?,
);
}
"ConflictResolution" => {
builder = builder.set_conflict_resolution(crate::protocol_serde::shape_conflict_resolution::de_conflict_resolution(
tokens,
_value,
depth + 1,
)?);
}
"ExportingConfig" => {
builder = builder.set_exporting_config(crate::protocol_serde::shape_exporting_config::de_exporting_config(
tokens,
_value,
depth + 1,
)?);
}
_ => ::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",
)),
}
}