pub fn ser_currency_display_format_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::CurrencyDisplayFormatConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.prefix {
object.key("Prefix").string(var_1.as_str());
}
if let Some(var_2) = &input.suffix {
object.key("Suffix").string(var_2.as_str());
}
if let Some(var_3) = &input.separator_configuration {
#[allow(unused_mut)]
let mut object_4 = object.key("SeparatorConfiguration").start_object();
crate::protocol_serde::shape_numeric_separator_configuration::ser_numeric_separator_configuration(&mut object_4, var_3)?;
object_4.finish();
}
if let Some(var_5) = &input.symbol {
object.key("Symbol").string(var_5.as_str());
}
if let Some(var_6) = &input.decimal_places_configuration {
#[allow(unused_mut)]
let mut object_7 = object.key("DecimalPlacesConfiguration").start_object();
crate::protocol_serde::shape_decimal_places_configuration::ser_decimal_places_configuration(&mut object_7, var_6)?;
object_7.finish();
}
if let Some(var_8) = &input.number_scale {
object.key("NumberScale").string(var_8.as_str());
}
if let Some(var_9) = &input.negative_value_configuration {
#[allow(unused_mut)]
let mut object_10 = object.key("NegativeValueConfiguration").start_object();
crate::protocol_serde::shape_negative_value_configuration::ser_negative_value_configuration(&mut object_10, var_9)?;
object_10.finish();
}
if let Some(var_11) = &input.null_value_format_configuration {
#[allow(unused_mut)]
let mut object_12 = object.key("NullValueFormatConfiguration").start_object();
crate::protocol_serde::shape_null_value_format_configuration::ser_null_value_format_configuration(&mut object_12, var_11)?;
object_12.finish();
}
Ok(())
}
pub(crate) fn de_currency_display_format_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::CurrencyDisplayFormatConfiguration>, ::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::CurrencyDisplayFormatConfigurationBuilder::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() {
"Prefix" => {
builder = builder.set_prefix(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Suffix" => {
builder = builder.set_suffix(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"SeparatorConfiguration" => {
builder = builder.set_separator_configuration(
crate::protocol_serde::shape_numeric_separator_configuration::de_numeric_separator_configuration(tokens, _value)?,
);
}
"Symbol" => {
builder = builder.set_symbol(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"DecimalPlacesConfiguration" => {
builder = builder.set_decimal_places_configuration(
crate::protocol_serde::shape_decimal_places_configuration::de_decimal_places_configuration(tokens, _value)?,
);
}
"NumberScale" => {
builder = builder.set_number_scale(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::NumberScale::from(u.as_ref())))
.transpose()?,
);
}
"NegativeValueConfiguration" => {
builder = builder.set_negative_value_configuration(
crate::protocol_serde::shape_negative_value_configuration::de_negative_value_configuration(tokens, _value)?,
);
}
"NullValueFormatConfiguration" => {
builder = builder.set_null_value_format_configuration(
crate::protocol_serde::shape_null_value_format_configuration::de_null_value_format_configuration(tokens, _value)?,
);
}
_ => ::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",
)),
}
}