aws_sdk_s3/protocol_serde/
shape_grant.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_grant(
3    input: &crate::types::Grant,
4    writer: ::aws_smithy_xml::encode::ElWriter,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    #[allow(unused_mut)]
7    let mut scope = writer.finish();
8    if let Some(var_1) = &input.grantee {
9        let inner_writer = scope
10            .start_el("Grantee")
11            .write_ns("http://www.w3.org/2001/XMLSchema-instance", Some("xsi"));
12        crate::protocol_serde::shape_grantee::ser_grantee(var_1, inner_writer)?
13    }
14    if let Some(var_2) = &input.permission {
15        let mut inner_writer = scope.start_el("Permission").finish();
16        inner_writer.data(var_2.as_str());
17    }
18    scope.finish();
19    Ok(())
20}
21
22#[allow(clippy::needless_question_mark)]
23pub fn de_grant(
24    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
25) -> ::std::result::Result<crate::types::Grant, ::aws_smithy_xml::decode::XmlDecodeError> {
26    #[allow(unused_mut)]
27    let mut builder = crate::types::Grant::builder();
28    while let Some(mut tag) = decoder.next_tag() {
29        match tag.start_el() {
30            s if s.matches("Grantee") /* Grantee com.amazonaws.s3#Grant$Grantee */ =>  {
31                let var_3 =
32                    Some(
33                        crate::protocol_serde::shape_grantee::de_grantee(&mut tag)
34                        ?
35                    )
36                ;
37                builder = builder.set_grantee(var_3);
38            }
39            ,
40            s if s.matches("Permission") /* Permission com.amazonaws.s3#Grant$Permission */ =>  {
41                let var_4 =
42                    Some(
43                        Result::<crate::types::Permission, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
44                            crate::types::Permission::from(
45                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
46                            )
47                        )
48                        ?
49                    )
50                ;
51                builder = builder.set_permission(var_4);
52            }
53            ,
54            _ => {}
55        }
56    }
57    Ok(builder.build())
58}