aws_sdk_sagemaker/protocol_serde/
shape_source_algorithm_specification.rs1pub fn ser_source_algorithm_specification(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::SourceAlgorithmSpecification,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.source_algorithms {
7 let mut array_2 = object.key("SourceAlgorithms").start_array();
8 for item_3 in var_1 {
9 {
10 #[allow(unused_mut)]
11 let mut object_4 = array_2.value().start_object();
12 crate::protocol_serde::shape_source_algorithm::ser_source_algorithm(&mut object_4, item_3)?;
13 object_4.finish();
14 }
15 }
16 array_2.finish();
17 }
18 Ok(())
19}
20
21pub(crate) fn de_source_algorithm_specification<'a, I>(
22 tokens: &mut ::std::iter::Peekable<I>,
23) -> ::std::result::Result<Option<crate::types::SourceAlgorithmSpecification>, ::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::SourceAlgorithmSpecificationBuilder::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 "SourceAlgorithms" => {
37 builder =
38 builder.set_source_algorithms(crate::protocol_serde::shape_source_algorithm_list::de_source_algorithm_list(tokens)?);
39 }
40 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
41 },
42 other => {
43 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
44 "expected object key or end object, found: {:?}",
45 other
46 )))
47 }
48 }
49 }
50 Ok(Some(crate::serde_util::source_algorithm_specification_correct_errors(builder).build()))
51 }
52 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
53 "expected start object or null",
54 )),
55 }
56}