aws_sdk_s3/protocol_serde/
shape_server_side_encryption_rule.rspub fn ser_server_side_encryption_rule(
input: &crate::types::ServerSideEncryptionRule,
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_1) = &input.apply_server_side_encryption_by_default {
let inner_writer = scope.start_el("ApplyServerSideEncryptionByDefault");
crate::protocol_serde::shape_server_side_encryption_by_default::ser_server_side_encryption_by_default(var_1, inner_writer)?
}
if let Some(var_2) = &input.bucket_key_enabled {
let mut inner_writer = scope.start_el("BucketKeyEnabled").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_2).encode());
}
scope.finish();
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_server_side_encryption_rule(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::ServerSideEncryptionRule, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::ServerSideEncryptionRule::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("ApplyServerSideEncryptionByDefault") => {
let var_3 =
Some(
crate::protocol_serde::shape_server_side_encryption_by_default::de_server_side_encryption_by_default(&mut tag)
?
)
;
builder = builder.set_apply_server_side_encryption_by_default(var_3);
}
,
s if s.matches("BucketKeyEnabled") => {
let var_4 =
Some(
{
<bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3#BucketKeyEnabled`)"))
}
?
)
;
builder = builder.set_bucket_key_enabled(var_4);
}
,
_ => {}
}
}
Ok(builder.build())
}