// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_s3_key_filter(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::S3KeyFilter, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::S3KeyFilter::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("FilterRule") /* FilterRules com.amazonaws.s3#S3KeyFilter$FilterRules */ =>  {
                let var_1 =
                    Some(
                        Result::<::std::vec::Vec::<crate::types::FilterRule>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
                            let mut list_2 = builder.filter_rules.take().unwrap_or_default();
                            list_2.push(
                                crate::protocol_serde::shape_filter_rule::de_filter_rule(&mut tag)
                                ?
                            );
                            list_2
                        })
                        ?
                    )
                ;
                builder = builder.set_filter_rules(var_1);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}

pub fn ser_s3_key_filter(
    input: &crate::types::S3KeyFilter,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_3) = &input.filter_rules {
        for list_item_4 in var_3 {
            {
                let inner_writer = scope.start_el("FilterRule");
                crate::protocol_serde::shape_filter_rule::ser_filter_rule(list_item_4, inner_writer)?
            }
        }
    }
    scope.finish();
    Ok(())
}
