pub(crate) fn de_savings_opportunity(
decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<crate::types::SavingsOpportunity, ::aws_smithy_cbor::decode::DeserializeError> {
#[allow(clippy::match_single_binding)]
fn pair(
mut builder: crate::types::builders::SavingsOpportunityBuilder,
decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<crate::types::builders::SavingsOpportunityBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
builder = match decoder.str()?.as_ref() {
"savingsOpportunityPercentage" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_savings_opportunity_percentage(Some(decoder.double()?)))
})?,
"estimatedMonthlySavings" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_estimated_monthly_savings(Some(
crate::protocol_serde::shape_estimated_monthly_savings::de_estimated_monthly_savings(decoder)?,
)))
})?,
_ => {
decoder.skip()?;
builder
}
};
Ok(builder)
}
let mut builder = crate::types::builders::SavingsOpportunityBuilder::default();
match decoder.map()? {
None => loop {
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
break;
}
_ => {
builder = pair(builder, decoder)?;
}
};
},
Some(n) => {
for _ in 0..n {
builder = pair(builder, decoder)?;
}
}
};
#[allow(clippy::needless_question_mark)]
{
return Ok(builder.build());
}
}