aws_sdk_sagemaker/protocol_serde/
shape_async_inference_config.rs1pub fn ser_async_inference_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::AsyncInferenceConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.client_config {
7 #[allow(unused_mut)]
8 let mut object_2 = object.key("ClientConfig").start_object();
9 crate::protocol_serde::shape_async_inference_client_config::ser_async_inference_client_config(&mut object_2, var_1)?;
10 object_2.finish();
11 }
12 if let Some(var_3) = &input.output_config {
13 #[allow(unused_mut)]
14 let mut object_4 = object.key("OutputConfig").start_object();
15 crate::protocol_serde::shape_async_inference_output_config::ser_async_inference_output_config(&mut object_4, var_3)?;
16 object_4.finish();
17 }
18 Ok(())
19}
20
21pub(crate) fn de_async_inference_config<'a, I>(
22 tokens: &mut ::std::iter::Peekable<I>,
23) -> ::std::result::Result<Option<crate::types::AsyncInferenceConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
24where
25 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
26{
27 match tokens.next().transpose()? {
28 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
29 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
30 #[allow(unused_mut)]
31 let mut builder = crate::types::builders::AsyncInferenceConfigBuilder::default();
32 loop {
33 match tokens.next().transpose()? {
34 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
35 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
36 "ClientConfig" => {
37 builder = builder.set_client_config(
38 crate::protocol_serde::shape_async_inference_client_config::de_async_inference_client_config(tokens)?,
39 );
40 }
41 "OutputConfig" => {
42 builder = builder.set_output_config(
43 crate::protocol_serde::shape_async_inference_output_config::de_async_inference_output_config(tokens)?,
44 );
45 }
46 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
47 },
48 other => {
49 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
50 "expected object key or end object, found: {:?}",
51 other
52 )))
53 }
54 }
55 }
56 Ok(Some(crate::serde_util::async_inference_config_correct_errors(builder).build()))
57 }
58 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
59 "expected start object or null",
60 )),
61 }
62}