aws_sdk_datasync/protocol_serde/
shape_source_manifest_config.rs

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