pub fn ser_axis_label_options(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::AxisLabelOptions,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.font_configuration {
#[allow(unused_mut)]
let mut object_2 = object.key("FontConfiguration").start_object();
crate::protocol_serde::shape_font_configuration::ser_font_configuration(&mut object_2, var_1)?;
object_2.finish();
}
if let Some(var_3) = &input.custom_label {
object.key("CustomLabel").string(var_3.as_str());
}
if let Some(var_4) = &input.apply_to {
#[allow(unused_mut)]
let mut object_5 = object.key("ApplyTo").start_object();
crate::protocol_serde::shape_axis_label_reference_options::ser_axis_label_reference_options(&mut object_5, var_4)?;
object_5.finish();
}
Ok(())
}
pub(crate) fn de_axis_label_options<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::AxisLabelOptions>, ::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::AxisLabelOptionsBuilder::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() {
"FontConfiguration" => {
builder = builder
.set_font_configuration(crate::protocol_serde::shape_font_configuration::de_font_configuration(tokens, _value)?);
}
"CustomLabel" => {
builder = builder.set_custom_label(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"ApplyTo" => {
builder = builder.set_apply_to(
crate::protocol_serde::shape_axis_label_reference_options::de_axis_label_reference_options(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",
)),
}
}