pub fn ser_ingress_string_to_evaluate(
encoder: &mut ::aws_smithy_cbor::Encoder,
input: &crate::types::IngressStringToEvaluate,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
encoder.map(1);
match input {
crate::types::IngressStringToEvaluate::Attribute(inner) => {
encoder.str("Attribute").str(inner.as_str());
}
crate::types::IngressStringToEvaluate::Analysis(inner) => {
encoder.str("Analysis");
crate::protocol_serde::shape_ingress_analysis::ser_ingress_analysis(encoder, inner)?;
}
crate::types::IngressStringToEvaluate::Unknown => {
return ::std::result::Result::Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
"IngressStringToEvaluate",
))
}
}
::std::result::Result::Ok(())
}
pub(crate) fn de_ingress_string_to_evaluate(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::IngressStringToEvaluate, ::aws_smithy_cbor::decode::DeserializeError> {
if depth >= 128u32 {
return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
"maximum nesting depth exceeded",
decoder.position(),
));
}
#[allow(unused_variables)]
fn pair(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::IngressStringToEvaluate, ::aws_smithy_cbor::decode::DeserializeError> {
Ok(match decoder.str()?.as_ref() {
"Attribute" => crate::types::IngressStringToEvaluate::Attribute(
decoder.string().map(|s| crate::types::IngressStringEmailAttribute::from(s.as_ref()))?,
),
"Analysis" => crate::types::IngressStringToEvaluate::Analysis(crate::protocol_serde::shape_ingress_analysis::de_ingress_analysis(
decoder,
depth + 1,
)?),
_ => {
decoder.skip()?;
crate::types::IngressStringToEvaluate::Unknown
}
})
}
match decoder.map()? {
None => {
let variant = pair(decoder, depth)?;
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
Ok(variant)
}
ty => Err(::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
ty,
decoder.position(),
)),
}
}
Some(1) => pair(decoder, depth),
Some(_) => Err(::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position())),
}
}