Skip to main content

aws_sdk_personalize/protocol_serde/
shape_batch_segment_job_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_batch_segment_job_input(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::BatchSegmentJobInput,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    if let Some(var_1) = &input.s3_data_source {
7        #[allow(unused_mut)]
8        let mut object_2 = object.key("s3DataSource").start_object();
9        crate::protocol_serde::shape_s3_data_config::ser_s3_data_config(&mut object_2, var_1)?;
10        object_2.finish();
11    }
12    Ok(())
13}
14
15pub(crate) fn de_batch_segment_job_input<'a, I>(
16    tokens: &mut ::std::iter::Peekable<I>,
17    _value: &'a [u8],
18) -> ::std::result::Result<Option<crate::types::BatchSegmentJobInput>, ::aws_smithy_json::deserialize::error::DeserializeError>
19where
20    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
21{
22    match tokens.next().transpose()? {
23        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
24        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
25            #[allow(unused_mut)]
26            let mut builder = crate::types::builders::BatchSegmentJobInputBuilder::default();
27            loop {
28                match tokens.next().transpose()? {
29                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
30                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
31                        "s3DataSource" => {
32                            builder = builder.set_s3_data_source(crate::protocol_serde::shape_s3_data_config::de_s3_data_config(tokens, _value)?);
33                        }
34                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
35                    },
36                    other => {
37                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
38                            "expected object key or end object, found: {other:?}"
39                        )))
40                    }
41                }
42            }
43            Ok(Some(crate::serde_util::batch_segment_job_input_correct_errors(builder).build()))
44        }
45        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
46            "expected start object or null",
47        )),
48    }
49}