pub fn ser_hours_of_operation_config(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::HoursOfOperationConfig,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("Day").string(input.day.as_str());
}
if let Some(var_1) = &input.start_time {
#[allow(unused_mut)]
let mut object_2 = object.key("StartTime").start_object();
crate::protocol_serde::shape_hours_of_operation_time_slice::ser_hours_of_operation_time_slice(&mut object_2, var_1)?;
object_2.finish();
}
if let Some(var_3) = &input.end_time {
#[allow(unused_mut)]
let mut object_4 = object.key("EndTime").start_object();
crate::protocol_serde::shape_hours_of_operation_time_slice::ser_hours_of_operation_time_slice(&mut object_4, var_3)?;
object_4.finish();
}
Ok(())
}
pub(crate) fn de_hours_of_operation_config<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::HoursOfOperationConfig>, ::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::HoursOfOperationConfigBuilder::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() {
"Day" => {
builder = builder.set_day(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::HoursOfOperationDays::from(u.as_ref())))
.transpose()?,
);
}
"StartTime" => {
builder = builder.set_start_time(
crate::protocol_serde::shape_hours_of_operation_time_slice::de_hours_of_operation_time_slice(tokens)?,
);
}
"EndTime" => {
builder = builder
.set_end_time(crate::protocol_serde::shape_hours_of_operation_time_slice::de_hours_of_operation_time_slice(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(
crate::serde_util::hours_of_operation_config_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}