#[allow(unused_mut)]
pub fn ser_data_storage(
mut writer: ::aws_smithy_query::QueryValueWriter,
input: &crate::types::DataStorage,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope_1 = writer.prefix("Maximum");
if let Some(var_2) = &input.maximum {
scope_1.number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_2).into()),
);
}
#[allow(unused_mut)]
let mut scope_3 = writer.prefix("Minimum");
if let Some(var_4) = &input.minimum {
scope_3.number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_4).into()),
);
}
#[allow(unused_mut)]
let mut scope_5 = writer.prefix("Unit");
if let Some(var_6) = &input.unit {
scope_5.string(var_6.as_str());
}
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_data_storage(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
depth: u32,
) -> ::std::result::Result<crate::types::DataStorage, ::aws_smithy_xml::decode::XmlDecodeError> {
if depth >= 128u32 {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("maximum nesting depth exceeded"));
}
#[allow(unused_mut)]
let mut builder = crate::types::DataStorage::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("Maximum") => {
let var_7 =
Some(
{
<i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.elasticache#IntegerOptional`)"))
}
?
)
;
builder = builder.set_maximum(var_7);
}
,
s if s.matches("Minimum") => {
let var_8 =
Some(
{
<i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.elasticache#IntegerOptional`)"))
}
?
)
;
builder = builder.set_minimum(var_8);
}
,
s if s.matches("Unit") => {
let var_9 =
Some(
Result::<crate::types::DataStorageUnit, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::DataStorageUnit::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_unit(var_9);
}
,
_ => {}
}
}
Ok(crate::serde_util::data_storage_correct_errors(builder).build())
}