aws_sdk_s3/protocol_serde/
shape_routing_rule.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// 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(())
}