pub(crate) fn de_x12_envelope<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::X12Envelope>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::X12EnvelopeBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"common" => {
builder = builder.set_common(crate::protocol_serde::shape_x12_outbound_edi_headers::de_x12_outbound_edi_headers(
tokens,
)?);
}
"wrapOptions" => {
builder = builder.set_wrap_options(crate::protocol_serde::shape_wrap_options::de_wrap_options(tokens)?);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {:?}",
other
)))
}
}
}
Ok(Some(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}
pub fn ser_x12_envelope(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::X12Envelope,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.common {
#[allow(unused_mut)]
let mut object_2 = object.key("common").start_object();
crate::protocol_serde::shape_x12_outbound_edi_headers::ser_x12_outbound_edi_headers(&mut object_2, var_1)?;
object_2.finish();
}
if let Some(var_3) = &input.wrap_options {
#[allow(unused_mut)]
let mut object_4 = object.key("wrapOptions").start_object();
crate::protocol_serde::shape_wrap_options::ser_wrap_options(&mut object_4, var_3)?;
object_4.finish();
}
Ok(())
}