aws_sdk_ecs/protocol_serde/
shape_tmpfs.rs1pub fn ser_tmpfs(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::Tmpfs,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("containerPath").string(input.container_path.as_str());
8 }
9 {
10 object.key("size").number(
11 #[allow(clippy::useless_conversion)]
12 ::aws_smithy_types::Number::NegInt((input.size).into()),
13 );
14 }
15 if let Some(var_1) = &input.mount_options {
16 let mut array_2 = object.key("mountOptions").start_array();
17 for item_3 in var_1 {
18 {
19 array_2.value().string(item_3.as_str());
20 }
21 }
22 array_2.finish();
23 }
24 Ok(())
25}
26
27pub(crate) fn de_tmpfs<'a, I>(
28 tokens: &mut ::std::iter::Peekable<I>,
29) -> ::std::result::Result<Option<crate::types::Tmpfs>, ::aws_smithy_json::deserialize::error::DeserializeError>
30where
31 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
32{
33 match tokens.next().transpose()? {
34 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
35 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
36 #[allow(unused_mut)]
37 let mut builder = crate::types::builders::TmpfsBuilder::default();
38 loop {
39 match tokens.next().transpose()? {
40 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
41 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
42 "containerPath" => {
43 builder = builder.set_container_path(
44 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
45 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
46 .transpose()?,
47 );
48 }
49 "size" => {
50 builder = builder.set_size(
51 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
52 .map(i32::try_from)
53 .transpose()?,
54 );
55 }
56 "mountOptions" => {
57 builder = builder.set_mount_options(crate::protocol_serde::shape_string_list::de_string_list(tokens)?);
58 }
59 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
60 },
61 other => {
62 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
63 "expected object key or end object, found: {:?}",
64 other
65 )))
66 }
67 }
68 }
69 Ok(Some(crate::serde_util::tmpfs_correct_errors(builder).build().map_err(|err| {
70 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
71 })?))
72 }
73 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
74 "expected start object or null",
75 )),
76 }
77}