aws_sdk_s3/protocol_serde/
shape_default_retention.rspub fn ser_default_retention(
input: &crate::types::DefaultRetention,
writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope = writer.finish();
if let Some(var_1) = &input.mode {
let mut inner_writer = scope.start_el("Mode").finish();
inner_writer.data(var_1.as_str());
}
if let Some(var_2) = &input.days {
let mut inner_writer = scope.start_el("Days").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_2).encode());
}
if let Some(var_3) = &input.years {
let mut inner_writer = scope.start_el("Years").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_3).encode());
}
scope.finish();
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_default_retention(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::DefaultRetention, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::DefaultRetention::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("Mode") => {
let var_4 =
Some(
Result::<crate::types::ObjectLockRetentionMode, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::ObjectLockRetentionMode::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_mode(var_4);
}
,
s if s.matches("Days") => {
let var_5 =
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.s3#Days`)"))
}
?
)
;
builder = builder.set_days(var_5);
}
,
s if s.matches("Years") => {
let var_6 =
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.s3#Years`)"))
}
?
)
;
builder = builder.set_years(var_6);
}
,
_ => {}
}
}
Ok(builder.build())
}