// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_record_expiration(
    input: &crate::types::RecordExpiration,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    {
        let mut inner_writer = scope.start_el("Expiration").finish();
        inner_writer.data(input.expiration.as_str());
    }
    if let Some(var_1) = &input.days {
        let mut inner_writer = scope.start_el("Days").finish();
        inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_1).encode());
    }
    scope.finish();
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_record_expiration(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::RecordExpiration, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::RecordExpiration::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("Expiration") /* Expiration com.amazonaws.s3#RecordExpiration$Expiration */ =>  {
                let var_2 =
                    Some(
                        Result::<crate::types::ExpirationState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::ExpirationState::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_expiration(var_2);
            }
            ,
            s if s.matches("Days") /* Days com.amazonaws.s3#RecordExpiration$Days */ =>  {
                let var_3 =
                    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#RecordExpirationDays`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_days(var_3);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::record_expiration_correct_errors(builder)
        .build()
        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}
