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) -> 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(decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder) -> Result<crate::types::Grant, ::aws_smithy_xml::decode::XmlDecodeError> {
24    #[allow(unused_mut)]
25    let mut builder = crate::types::Grant::builder();
26    while let Some(mut tag) = decoder.next_tag() {
27        match tag.start_el() {
28            s if s.matches("Grantee") /* Grantee com.amazonaws.s3#Grant$Grantee */ =>  {
29                let var_3 =
30                    Some(
31                        crate::protocol_serde::shape_grantee::de_grantee(&mut tag)
32                        ?
33                    )
34                ;
35                builder = builder.set_grantee(var_3);
36            }
37            ,
38            s if s.matches("Permission") /* Permission com.amazonaws.s3#Grant$Permission */ =>  {
39                let var_4 =
40                    Some(
41                        Result::<crate::types::Permission, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
42                            crate::types::Permission::from(
43                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
44                            )
45                        )
46                        ?
47                    )
48                ;
49                builder = builder.set_permission(var_4);
50            }
51            ,
52            _ => {}
53        }
54    }
55    Ok(builder.build())
56}