#[allow(clippy::needless_question_mark)]
pub fn de_redirect_all_requests_to(
decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::RedirectAllRequestsTo, ::aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::types::RedirectAllRequestsTo::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("HostName") => {
let var_1 =
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_host_name(var_1);
}
,
s if s.matches("Protocol") => {
let var_2 =
Some(
Result::<crate::types::Protocol, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::types::Protocol::from(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_protocol(var_2);
}
,
_ => {}
}
}
Ok(crate::serde_util::redirect_all_requests_to_correct_errors(builder)
.build()
.map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}
pub fn ser_redirect_all_requests_to(
input: &crate::types::RedirectAllRequestsTo,
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("HostName").finish();
inner_writer.data(input.host_name.as_str());
}
if let Some(var_3) = &input.protocol {
let mut inner_writer = scope.start_el("Protocol").finish();
inner_writer.data(var_3.as_str());
}
scope.finish();
Ok(())
}