// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_routing_rule(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::RoutingRule, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::RoutingRule::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("Condition") /* Condition com.amazonaws.s3#RoutingRule$Condition */ =>  {
                let var_1 =
                    Some(
                        crate::protocol_serde::shape_condition::de_condition(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_condition(var_1);
            }
            ,
            s if s.matches("Redirect") /* Redirect com.amazonaws.s3#RoutingRule$Redirect */ =>  {
                let var_2 =
                    Some(
                        crate::protocol_serde::shape_redirect::de_redirect(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_redirect(var_2);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::routing_rule_correct_errors(builder).build())
}

pub fn ser_routing_rule(
    input: &crate::types::RoutingRule,
    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_3) = &input.condition {
        let inner_writer = scope.start_el("Condition");
        crate::protocol_serde::shape_condition::ser_condition(var_3, inner_writer)?
    }
    if let Some(var_4) = &input.redirect {
        let inner_writer = scope.start_el("Redirect");
        crate::protocol_serde::shape_redirect::ser_redirect(var_4, inner_writer)?
    }
    scope.finish();
    Ok(())
}
