aws_sdk_s3/protocol_serde/
shape_tiering.rs#[allow(clippy::needless_question_mark)]
pub fn de_tiering(decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder) -> Result<crate::types::Tiering, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::Tiering::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("Days") => {
let var_1 =
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#IntelligentTieringDays`)"))
}
?
)
;
builder = builder.set_days(var_1);
}
,
s if s.matches("AccessTier") => {
let var_2 =
Some(
Result::<crate::types::IntelligentTieringAccessTier, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::IntelligentTieringAccessTier::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_access_tier(var_2);
}
,
_ => {}
}
}
Ok(crate::serde_util::tiering_correct_errors(builder)
.build()
.map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}
pub fn ser_tiering(
input: &crate::types::Tiering,
writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope = writer.finish();
{
let mut inner_writer = scope.start_el("Days").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(input.days).encode());
}
{
let mut inner_writer = scope.start_el("AccessTier").finish();
inner_writer.data(input.access_tier.as_str());
}
scope.finish();
Ok(())
}