pub fn ser_lambda_function_association(
input: &crate::types::LambdaFunctionAssociation,
writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
#[allow(unused_mut)]
let mut scope = writer.finish();
{
let mut inner_writer = scope.start_el("LambdaFunctionARN").finish();
inner_writer.data(input.lambda_function_arn.as_str());
}
{
let mut inner_writer = scope.start_el("EventType").finish();
inner_writer.data(input.event_type.as_str());
}
if let Some(var_1) = &input.include_body {
let mut inner_writer = scope.start_el("IncludeBody").finish();
inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_1).encode());
}
scope.finish();
Ok(())
}
#[allow(clippy::needless_question_mark)]
pub fn de_lambda_function_association(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::LambdaFunctionAssociation, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::LambdaFunctionAssociation::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("LambdaFunctionARN") => {
let var_2 =
Some(
Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_lambda_function_arn(var_2);
}
,
s if s.matches("EventType") => {
let var_3 =
Some(
Result::<crate::types::EventType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::EventType::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_event_type(var_3);
}
,
s if s.matches("IncludeBody") => {
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.cloudfront#boolean`)"))
}
?
)
;
builder = builder.set_include_body(var_4);
}
,
_ => {}
}
}
Ok(crate::serde_util::lambda_function_association_correct_errors(builder)
.build()
.map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}